squirrel英文文档

 

http://squirrel-lang.org/doc/squirrel2.html

 

 

 

转自我的cnblogs

最近在搜索AngleScript bug时,突然发现一个新的轻量级OO脚本语言Squirrel 翻译过来就是松鼠的意思

来看下这个脚本的样子:

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);}

class Entity{ constructor(etype,entityname) { name = entityname; type = etype; } x = 0; y = 0; z = 0; name = null; type = null;}function Entity::MoveTo(newx,newy,newz){ x = newx; y = newy; z = newz;}class Player extends Entity { constructor(entityname) { Entity.constructor("Player",entityname) } function DoDomething() { ::print("something"); } } local newplayer = Player("da playar"); newplayer.MoveTo(100,200,300);

特性:

1. 开源,zlib的那种无限制使用的license

2. 动态类型

3. Delegation代理支持

4. 支持类,及继承

5. 高阶函数功能

6. Generator

7. 纤程(Coroutines)

8. 尾递归(tail recursion)

9. 异常捕获

10. 引用计数方式的垃圾回收(有点过时)

11. 弱引用

12. 6k行编译器及虚拟机代码

13. 可选的16位字符串

14. 支持64位cpu

总体观感,这种脚本语言语法结构类似C++及lua的杂合体,很多地方像lua。OO部分又像Python

这里是一个完整文档说明,可以详细了解其vm接口及api调用。

不过到目前为主,未看到有成熟的商业项目使用

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值