ProjectTera is a small statically typed interpreted programming language and compiler/interpreter toolchain built from scratch using TypeScript. It features a full pipeline including lexical analysis, custom Abstract Syntax Tree (AST) definitions, a static type checker, and a tree-walk interpreter!
- Lexer & Parser: Tokenizes source code into a robust AST supporting expressions, statements, control flow, and functions.
- Static Type Checker: Enforces strict type safety (
int,string,boolean, custom array types, etc.) with lexical scope management. - Tree-Walk Interpreter: Dynamically evaluates and executes statements, variable assignments, index mutations, and built-in functions at runtime.
- Modern TypeScript: Clean, modular codebase designed with extensibility in mind.
AST.ts— Defines the Abstract Syntax Tree node structures and expression unions.Lexer.ts— Tokenizes the raw source code text.Parser.ts— Parses tokens into syntax trees.TypeChecker.ts— Performs static analysis and type safety validation.Interpreter.ts— Executes the AST nodes at runtime with environment scoping.bin.ts/index.ts— Entry points for running the language compiler/interpreter.
Make sure you have Node.js installed on your machine.
- Clone the repository:
git clone [https://github.com/grivia0/projecttera.git](https://github.com/grivia0/projecttera.git) cd ProjectTerra - Install dependencies:
npm install
- Build and run a test file (test.tera):
npm run build node dist/bin.js test.tera