Project Structure
The project follows the file structure shown in the tree below. It should be mentioned that only the part of the file tree unique to the project is shown. Files and directories commonly found in projects using a similar stack (Typescript, Vite, Deno, for example) such as .github/ or package.json have been omitted. The number of files in each directory has also intentionally been shortened to keep the focus of the structure, not the files themselves. The remaining files in the tree are either shown because they are significant to the structure or as examples.
The grammar includes the grammar of the implemented language spread across multiple EBNF files. These files are strictly used as documentation and are in no way involved in the build process of the interpreter.
The implementation is completely contained inside the src directory. The command-line as well as the library entry points to the interpreter can be found in cli.ts and main.ts respectively.
The project groups its implementation by language-feature instead of interpreter-stages. For instance, there is not a Typescript file that contains all the parsers for the entire language and another file that contains the entire interpreter. Rather, there is a file for each language feature (such as assignments or strings) which contain all the interpreter stages for that specific feature. The feature files are located in the features directory. All feature files share the same internal file structure shown below.
As can be seen, the file structurally separates the parsing of each feature from its AST nodes which, in turn, contains and separates the remaining interpreter stages internally.
The util directory contains utility functionality that is not bound to a specific feature but used throughout the project.