项目作者: g-w1

项目描述 :
compiler for ez
高级语言: Rust
项目地址: git://github.com/g-w1/ezc.git
创建时间: 2020-09-05T23:39:18Z
项目社区:https://github.com/g-w1/ezc

开源协议:GNU General Public License v3.0

下载


ezc

Compiler for ez.

Documentation: https://jacobgw.com/ezc/

Goals

  • To learn a lot
  • ez should resemble english
  • Use only rust standard library
  • Write a working compiler.
  • Write a (minimal) standard library for ez in another language (zig, rust, c, asm, ..)

Instructions

To run just do ezc file use -g flag for debug info (it will generate a out.asm file). then you can open in gdb or lldb

To make use of the standard library, pass -stdlib-path /path/to/stdlib to the compiler. To compile the standard library, go into the lib directory in this compiler. Then run zig build in that directory and find the library in zig-cache/lib/libstd.a. You will probably need zig 0.7.1. You can find that here: https://ziglang.org/download/.

To test the code: cargo test
To test the generated code you can do cd tests; ./test.sh. Note: this requires gcc.

Dependencies:

  • Zig (0.7.1). NOTE: If you want to build without zig run HAS_NO_ZIG=1 cargo build. This may be useful if you are on a system without zig or want to provide your own standard library.
  • nasm
  • cargo
  • gcc (only for testing)

Resources

Features

  • [x] lexer

  • [x] ast (structs for ast items)

  • [x] parser

  • [x] codegen

  • [x] immutable assignments

  • [x] mutable variables

  • [x] semantic analysis.

  • [x] expressions (the start of recursive parsing)

  • [x] if statements

  • [x] loops

  • [x] fancy compile errors (with carets)

  • [x] functions

  • [x] modules

  • [x] char literals

  • [x] standard library

  • [x] io

  • [x] arrays and string literals

  • [x] finish blog bost

  • [x] finish documentation