游戏编程语言 Squirrel

jopen 12年前
     <p>Squirrel 是一种高层次势在必行/面向对象编程语言,设计是一个强大的脚本工具,适合的大小,内存带宽,实时性要求的应用,如游戏。它具有以下特性:</p>    <ul>     <li>Open Source MIT licence </li>     <li>dynamic typing </li>     <li>delegation </li>     <li>classes & inheritance </li>     <li>higher order functions </li>     <li>lexical scoping </li>     <li>generators </li>     <li>cooperative threads(coroutines)  </li>     <li>tail recursion </li>     <li>exception handling </li>     <li>automatic memory management (CPU bursts free; mixed approach ref counting/GC) </li>     <li>both compiler and virtual machine fit together in about 7k lines of C++ code and add only around 100kb-150kb the executable size. </li>     <li>optional 16bits characters strings</li>     <li>powerful embedding api      <ul>       <li>eg. function/classes can be defined by scripts or in C</li>       <li>eg. objects can fully exist in the VM or be bound to native code</li>       <li>eg. classes created in C can be extended by scripts or vice-versa</li>       <li>and more</li>      </ul> <p>Squirrel is inspired by languages like Python,Javascript and especially Lua(The API is very similar and the table code is based on the Lua one)</p> </li>    </ul>    <p>示例代码</p>    <pre class="brush:javascript; toolbar: true; auto-links: false;">local table = {  a = "10"  subtable = {   array = [1,2,3]  },  [10 + 123] = "expression index" }  local array=[ 1, 2, 3, { a = 10, b = "string" } ];  foreach(i,val in array) {  ::print("the type of val is"+typeof val); }</pre>    <p></p>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326607474515" target="_blank">http://www.open-open.com/lib/view/home/1326607474515</a></p>