Skip to content

ymd8bit/mycc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisite

Docker container install

docker build -t mycc:latest .

Docker container run

docker run -it --rm -v `pwd`:/workspace -t mycc:latest /bin/bash

Usage

Run with source file

cargo run -- resource/expr.txt

The source file may contain simple expression like below.

>> cat resource/expr.txt
-5 + (4 - 20) * 4

you might be able to see

...
    Finished dev [unoptimized + debuginfo] target(s) in 6.07s
     Running `target/debug/mycc resource/expr.txt`
source file path: resource/expr.txt
Some(BinaryOp { op: Add, lhs: UnaryOp { op: Minus, rhs: Number(5) }, rhs: BinaryOp { op: Mul, lhs: BinaryOp { op: Sub, lhs: Number(4), rhs: Number(20) }, rhs: Number(4) } })

Run tests

cargo test

you might be able to see

...
running 2 tests
test lexer::test_lexer ... ok
test parser::test_parser ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages