https://github.com/ubugeeei/minimum-compiler
https://github.com/ubugeeei/minimum-compiler
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ubugeeei/minimum-compiler
- Owner: ubugeeei
- Created: 2022-04-09T13:09:24.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-10T13:22:19.000Z (about 3 years ago)
- Last Synced: 2025-03-24T19:50:01.393Z (2 months ago)
- Language: Rust
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Usage
### compile to assembles and run
```rust
// main.rs
fn main() {
// input your expression
// ex)
// " 12 + 3 ; "
// "15 - 6 ;"
// "5 * 9 ; "
// " 24 / 12 ;"
let tokens = tokenize(" 12 / 3 ; ");
let expr = parse(&tokens, 0);
generate_expr(&expr);
}
``````sh
$ brew install nasm
``````sh
$ cargo run | bash assemble.sh
$ ./a.out
$ echo $?
```https://user-images.githubusercontent.com/71201308/162620197-755e1067-fe4f-4327-84fc-d1900c213bb2.mov
### build assembly sample
```sh
$ cd asm_sample
$ nasm -f macho64 -o main.o main.asm
$ ld -arch x86_64 -macosx_version_min 10.11 main.o -lSystem
```run
```sh
$ ./a.out
$ echo $?
```