https://github.com/ghaiklor/iterum
Interpreter for a subset of ECMA specification implemented on top of recursive descent parser
https://github.com/ghaiklor/iterum
ast ecma-specification interpreter iterum parser runtime typescript
Last synced: 9 months ago
JSON representation
Interpreter for a subset of ECMA specification implemented on top of recursive descent parser
- Host: GitHub
- URL: https://github.com/ghaiklor/iterum
- Owner: ghaiklor
- License: mit
- Created: 2019-02-19T18:21:24.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-05T08:40:08.000Z (over 1 year ago)
- Last Synced: 2025-04-28T15:55:27.327Z (9 months ago)
- Topics: ast, ecma-specification, interpreter, iterum, parser, runtime, typescript
- Language: TypeScript
- Homepage: https://www.ecma-international.org/ecma-262/9.0/index.html#sec-grammar-summary
- Size: 1.2 MB
- Stars: 16
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# iterum







[](https://github.com/ghaiklor)
[](https://twitter.com/ghaiklor)
_Iterum (latin) means “again, a second time, repeatedly, once more, for the second time, anew,”._
_This is my another attempt to create a simple, but fully implemented interpreter for a subset of ECMA specification._
__NOTE: This is an educational project, and it is not designed for use in production.__
## Why
For a last few years I was passionate about compilers, languages and similar stuff.
And I am still passionate about it.
However, all my knowledge was based on theoretical knowledge and not on a practical one.
So, I’ve written an interpreter to fasten it.
## Key Concepts
iterum itself is implemented on top of these key concepts:
- Recursive descent parser with a look-ahead by one character;
- Parser for an ECMA subset emits ESTree;
- Interpreter is implemented on top of traverser for different AST nodes;
## Getting Started
iterum is packed as an npm package, so you can easily run it with `npx`:
```bash
npx @ghaiklor/iterum --help
```
Create a file somewhere on your machine with an iterum code:
```javascript
// hello-world.js
function helloWorld() {
print "Hello, World";
}
helloWorld();
```
If you want to take a look into AST generated from the file above:
```bash
npx @ghaiklor/iterum --print-ast hello-world.js
```
Otherwise, you can interpret it:
```bash
npx @ghaiklor/iterum --interpret hello-world.js
```
## Contributing
Pull requests are welcome.
For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## How It Works
You can find rough explanation [here](./docs/index.md).
## License
[MIT License](./LICENSE)