Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evermake/stella
https://github.com/evermake/stella
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/evermake/stella
- Owner: evermake
- Created: 2024-02-10T13:37:22.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-04-07T09:56:48.000Z (9 months ago)
- Last Synced: 2024-09-17T20:45:42.833Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 571 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# stella-implementation-in-typescript
Template for an implementation of Stella in TypeScript (with ANTLRv4).
## Getting started
### Generating the parser
> Note: the generated parser is checked into git so that you don't have to run these commands yourself.
> The instructions are left here just for reference.First, make sure you have `antlr4` installed using `pip install antlr4-tools`.
Then, you must generate the Stella parser and lexer using `npm run antlr4`.
This script adds a `// @ts-nocheck` preamble to the generated files so they don't bother you with false positives.### Running the code
You can use any number of modules you want, but the main driver code should be in [`index.ts`](./src/index.ts).
Run `npm run build` to bundle it into 1 JS file under `build`, or use `npm run watch`
to run it in watch mode during development.To run the built code, use `node build [path/to/file.stella]`.
Your code will be tested by running the following commands:
```sh
npm install
npm run build
npm start --
```### AST
For your convenience, a hand-written AST is written in [`ast.ts`](./src/ast.ts)
to make it easier to work with the parser generated by ANTLR.
If you prefer using the Visitor pattern with the Concrete Syntax Tree, see the
code in [`visitors.ts`](./src/visitors.ts) that transforms the CST to AST.