找回密码
 点一下
查看: 1348|回复: 1

Milkyway galaxy precompiler

[复制链接]
发表于 2010-5-6 15:14:09 | 显示全部楼层 |阅读模式
Milkyway galaxy precompiler

This tool is a precompiler for the starcraft 2 scripting language galaxy. It extends the galaxy language. We call the extended language galaxy. A file containing the extended galaxy is taken and input and a regular galaxy file, compilable by sc2, is produced as output. This enables many language features to be added to the very simple galaxy language. Other possible features are syntax checking, type checking, and lexical scope analysis. The features currently available are listed in the features section. This works works on the command line, there is no GUI. The two arguments are inputfile and outputfile.
Features
    [li]Type Checking. Various type errors are reported. This includes calling non-existing functions; defining duplicate functions; calling a function with bad arguments; returning with in incorrecy type; not specifying a constant initializer.[/li]
    [li]Syntax Checking. The tool parses a file and reports any parsing errors. Errors show a line and column number. Some information about the error is given but I have tuned this very little.[/li]
    [li]Block comments are allowed.[/li]
    [li]Dynamic allocation. It is possible to use new() and destroy(). Check the dynamic allocation page for more info.[/li]
Future
    [li]Type checking. Add type checking so that for example "if 3 then .. " will give an appropriate error message.[/li][li]Lexical scoping. Are the variables you use actually in scope at the point where you use them? Are they declared?[/li][li]For loops. Allow the use of for loops.[/li][li]OOP concepts. Class methods that have access to the class they are defined in.[/li][li]Function pointers.[/li][li]Garbage collection in dynamic allocation.[/li]
Bugs
Generated code is compiled by sc2 so far. However very little testing has been done. Please help do so by using the features milkyway provides.
Usage
The tool uses the command line. The first argument is the input galaxy file to be read. The second optional argument is the file to write the output to.

感謝鈺的翻譯~~~
友情帮顶, 顺便简单翻译一下:

这个工具是一个星际2脚本的预编译器, 给galaxy脚本语言扩展一些语法和功能

主要特性:
1, 类型检查(任意类型错误都将报告出来, 包括调用不存在的函数, 重复定义函数, 调用函数时错误的传递参数, 返回不正确的类型, 常量没有初始化值)
2, 语法检查(这个工具会解析文件并报告语法错误, 包括行号列号, 有时会有一些简单的提示信息)
3, 增加了块注释的语法(就是/*...*/)
4, 增加动态分配功能(可以使用new和destroy, 具体请参考这个页面..链接自己去原文里找吧, 转贴里已经没了)

未来的特性:
1, 更强的类型检查, 比如说if 3 then会给出错误提示
2, 词法定位, 比如说某个变量, 你可以知道它是哪里定义的.(译者表示这个功能不知道嘛用, 做编辑器可能会用到)
3, for循环语法
4, 面向对象支持
5, 函数指针
6, 垃圾回收

BUGs:
目前为止, 所编译生成的代码是能通过sc2的, 但是还是需要你们多使用milkyway新增的语法来帮助我们进行测试

使用方法:
这个工具是命令行界面的, 第一个参数是要编译的目标脚本文件, 第二个参数是生成的文件位置

compiler0.0.1.zip

630 KB, 下载次数: 27

发表于 2010-5-6 16:17:42 | 显示全部楼层
友情帮顶, 顺便简单翻译一下:

这个工具是一个星际2脚本的预编译器, 给galaxy脚本语言扩展一些语法和功能

主要特性:
1, 类型检查(任意类型错误都将报告出来, 包括调用不存在的函数, 重复定义函数, 调用函数时错误的传递参数, 返回不正确的类型, 常量没有初始化值)
2, 语法检查(这个工具会解析文件并报告语法错误, 包括行号列号, 有时会有一些简单的提示信息)
3, 增加了块注释的语法(就是/*...*/)
4, 增加动态分配功能(可以使用new和destroy, 具体请参考这个页面..链接自己去原文里找吧, 转贴里已经没了)

未来的特性:
1, 更强的类型检查, 比如说if 3 then会给出错误提示
2, 词法定位, 比如说某个变量, 你可以知道它是哪里定义的.(译者表示这个功能不知道嘛用, 做编辑器可能会用到)
3, for循环语法
4, 面向对象支持
5, 函数指针
6, 垃圾回收

BUGs:
目前为止, 所编译生成的代码是能通过sc2的, 但是还是需要你们多使用milkyway新增的语法来帮助我们进行测试

使用方法:
这个工具是命令行界面的, 第一个参数是要编译的目标脚本文件, 第二个参数是生成的文件位置
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-9-28 19:13 , Processed in 0.118168 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表