An example learning interpreter using re2c and The LEMON Parser Generator.
- CMakeLists.txt Single build script;
- include/badcode.h Public API header;
- src/badcode.c Interpreter implementation;
- src/bcLexer.re Lexer implementation using re2c;
- src/bcParser.y Parser implementation using LEMON;
- src/bcValue.c BC_VALUE implementation;
- src/bcValueStack.c Interpreter BC_VALUE stack implementation;
- src/private/bcPrivate.h Private BadCode declarations;
- src/private/bcValue.h BC_VALUE declarations.
- src/private/bcValueStack.h Interpreter BC_VALUE stack implementation;
- tests/basic.c Simple test program, check whole Read-Eval-Print-Loop.
See build.sh script.
./build.sh
Build script (aka CMakeLists.txt downloads dependencies automaticaly from respective sites.
${CMAKE_CURRENT_BUILD_DIR}/bcLexer.c
Generated lexer from src/bcLexer.re${CMAKE_CURRENT_BUILD_DIR}/bcParser.c
${CMAKE_CURRENT_BUILD_DIR}/bcParser.h
Generated parser from src/bcParser.y