1 unstable release
0.3.1 | Jan 10, 2022 |
---|---|
0.3.0 |
|
#780 in Programming languages
81KB
2.5K
SLoC
RSCMM
- A C language Interpreter Library.
- A practice project to educate myself.
- RSCMM is a combine of Rust & CMM. CMM is contrary to CPP, means less than C.
Pipeline
Including RSCMM in your project
[dependencies]
rscmm = "0.3"
Implementation
src folder
- parser in src/core/parser
- semantic_analyzer in src/core/analyzer
- compiler in src/core/compiler
- vm in src/core/vm vm is used to run codes after compiling.
functionality
- ops: + - * / % && || ! == != <= >= < >
- funcs: declare, impls, recursive
- types: int, void
- controls: if & while
Example
int gcd(int a, int b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
int main() {
int p = gcd(99, 90);
p; // single variable statement means print.
}
// Run example
rscmm::compile_and_run("example/gcd.c").unwrap();
// Get vm codes
rscmm::compile_to_code("example/gcd.c").unwrap();
Dependencies
~2MB
~42K SLoC