lang
所属分类:collect
开发工具:Rust
文件大小:0KB
下载次数:0
上传日期:2015-05-31 04:03:09
上 传 者:
sh-1993
说明: 用Rust编写的命令式编程语言,
(An imperative programming language written in Rust,)
文件列表:
Cargo.lock (2639, 2015-05-30)
Cargo.toml (216, 2015-05-30)
examples/ (0, 2015-05-30)
examples/basic.lang (304, 2015-05-30)
src/ (0, 2015-05-30)
src/grammar.rustpeg (4185, 2015-05-30)
src/main.rs (27280, 2015-05-30)
tests/ (0, 2015-05-30)
tests/test.lang (340, 2015-05-30)
# lang (to be renamed)
`lang` is a C-like programming language designed for the purpose of learning about compiler construction. Examples can be found in the `examples` folder.
## Usage
```
$ cargo run -- -h
Usage: target/debug/lang [options]
Options:
-h --help print this help menu
-t --type TYPE output type (llvm (default), asm, or obj)
-o --output FILE output file name
```
Note that the compiler doesn't automatically link object files (yet), so after generating an object file with the `-t` flag, you can link by running `gcc` on the object file.
## Features
`lang` supports basic variable assignment, function calls, conditionals, loops, arithmetic, and relational operations. The three main types are `int` (a signed 32-bit integer), `string` (a null terminated string), and `bool`. `lang` also supports calling C functions as long as the necessary types are supported.
### In progress features
- Semantic analysis currently reports errors without reporting the location of the error, this will be fixed
- Add floating point and unsigned integer types of different widths
- Allow function definitions in any order
- Scope (currently everything inside a function is in the same scope)
- Arrays
- For loops (only while loops are supported at the moment)
- Allow parenthesis in expressions
### Long term features
- Dynamic memory
- Optional garbage collections
- Algebraic data types and pattern matching
近期下载者:
相关文件:
收藏者: