toylang
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

ToyLang logo

A toy programming language built with TypeScript for learning purposes.

Learning resources

Here are few excellent resources I followed while building ToyLang.

Examples

The syntax & semantics of the language is very similar to JavaScript with few differences.

To run examples from /examples folder, you simply need to run:

# yarn example <name_of_example>
yarn example factorial

API Usage

  1. Install toylang package
npm install toylang
  1. Use the package
const { Parser, Interpreter } = require("toylang");

const parser = new Parser();
const interpreter = new Interpreter();

const ast = parser.parse(`print(1+1);`);
interpreter.execute(ast);

Scope of the project

The scope of the project is only limited to educational purposes, the code itself is written for better understanding, rather than efficient or production use cases.

Todos

  • [ ] Write more tests.
  • [ ] Refactor ASTFactories.ts.
  • [ ] Refactor typings.
  • [ ] Add data structures (Arrays, Objects).
  • [ ] Add more examples.
  • [ ] Add support for imported modules.
  • [ ] Add support for Class declarations in interpreter.
  • [ ] More standard library functions.
  • [ ] Better error handling.
  • [ ] Overall refactor of the codebase.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    2
  • 1.0.0
    0

Package Sidebar

Install

npm i toylang

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

86.8 kB

Total Files

41

Last publish

Collaborators

  • anuraghazra