SHA256
1
0
Fork
You've already forked scr
0
A simple scripting language
  • C++ 97.6%
  • Makefile 2.4%
2025年05月01日 12:00:00 -05:00
examples initial commit 2025年05月01日 12:00:00 -05:00
.gitignore initial commit 2025年05月01日 12:00:00 -05:00
.prettierrc initial commit 2025年05月01日 12:00:00 -05:00
CHANGELOG initial commit 2025年05月01日 12:00:00 -05:00
compiler.cpp initial commit 2025年05月01日 12:00:00 -05:00
compiler.h initial commit 2025年05月01日 12:00:00 -05:00
executable.h initial commit 2025年05月01日 12:00:00 -05:00
lexer.cpp initial commit 2025年05月01日 12:00:00 -05:00
lexer.h initial commit 2025年05月01日 12:00:00 -05:00
Makefile initial commit 2025年05月01日 12:00:00 -05:00
README initial commit 2025年05月01日 12:00:00 -05:00
scr.cpp initial commit 2025年05月01日 12:00:00 -05:00
transpiler.cpp initial commit 2025年05月01日 12:00:00 -05:00
transpiler.h initial commit 2025年05月01日 12:00:00 -05:00
value.cpp initial commit 2025年05月01日 12:00:00 -05:00
value.h initial commit 2025年05月01日 12:00:00 -05:00
vm.cpp initial commit 2025年05月01日 12:00:00 -05:00
vm.h initial commit 2025年05月01日 12:00:00 -05:00

A basic scripting language (scr) for Programming Project 2 in COM S 3270 at Iowa
State University. Build `scr` with `make all`. Then, you can run any of the test
programs with `./scr ./examples/<name>.scr`.
The language supports local variable creation, assignment, references, and math
expressions, shortcutting logical expressions, equality expressions, and if
statements, while statements, and built-in function calls (print and sqrt).
I built a lexer, bytecode compiler (on the fly without a parse tree), and
virtual machine for the language. The language only supports numbers, lambdas,
and built-in function values. Also, if the first line of the file is a comment,
it is printed to stderr.
I have organized the codebase into separate files for each main part. Here are
some descriptions:
| Files | Description |
| ------------------ | ------------------------- |
| `compiler.h/cpp` | parsing and bytecode emit |
| `executable.h/cpp` | bytecode format functions |
| `lexer.h/cpp` | tokenization |
| `value.h/cpp` | value representation |
| `vm.h/cpp` | virtual machine |
| `transpiler.h/cpp` | scr-to-js transpiler |
Thank you for reviewing my submission.