A small but working language created for a Spotify tech talk, intended to demonstrate compiler design principles.
npm i
to install dependencies
npm run build
to compile the typescript to javascript
You can run the ttalk
CLI:
./ttalk run examples/overview.ttalk
You can also run ./ttalk -h
to list all available commands.
These are the core files, in execution order:
src/index.ts
: The entrypoint for the CLI, handles the commandssrc/lexer.ts
: The lexer - chunks the source into Tokenssrc/parser.ts
: The parser - transforms the Token list into an ASTsrc/ast.ts
: Typescript helper file containing ASTNode
types
src/compiler.ts
/src/compiler-js.ts
: The compiler - generates either bytecode or javascriptsrc/visitor/ts
: Typescript helper file defining theVisitor
interface (helping enforce the Visitor Pattern)
src/vm.ts
: The Virtual Machine capable of running the bytecode generated bysrc/compiler.ts