toys.ts

0.0.2 • Public • Published

toys.ts

WEB+DB PRESS Vol.125 に掲載されている kmizu 氏の『作って学ぶプログラミング言語のしくみ』を読んだので、そこで紹介されている Toys 言語の処理系を TypeScript により実装しました。

TODO: for 文、ラベル引数

Usage

$ cat test.toys
define factorial(n) {
  if(n < 2) {
    1;
  } else {
    n * factorial(n - 1);
  }
}
define main() {
  factorial(5);
}

$ npx toys.ts test.toys 
120

or

$ npm i -g toys.ts
$ toys test.toys
120
$ toys
Welcome to toys.ts!
> 

Package Sidebar

Install

npm i toys.ts

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

99.9 kB

Total Files

8

Last publish

Collaborators

  • shf0811