Contributing
ENG is organized as a small Rust interpreter. Changes are easiest to review when they are limited to the subsystem they actually affect.
Typical workflow
- Make a change.
- Run
cargo fmt. - Run
cargo test. - Run a relevant example with
cargo run -- run .... - Update the documentation if syntax or runtime behavior changed.
Adding syntax
A new language construct generally involves:
- adding or adjusting a
TokenKind - teaching the lexer to recognize the words
- adding parser logic
- adding an AST variant if needed
- compiling the AST to bytecode
- adding VM/runtime behavior
- adding tests
- documenting the syntax
Do not add a keyword if an identifier can safely represent the same concept.
Parser changes
ENG uses a handwritten recursive-descent parser. Keep new grammar forms explicit and unambiguous.
Every new statement should have a clear terminating period and block constructs should have a clear End. boundary.
Runtime changes
Runtime errors should use EnglingError::runtime(...) so they remain consistent with the existing error system.
Module problems should use EnglingError::module(...).
UI changes
GUI functionality is behind the ui Cargo feature. Avoid making the default interpreter depend on the GUI path.
Documentation
When changing syntax, update both the grammar/reference documentation and at least one runnable example.