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

1.0.5 • Public • Published

Tzo-Analyze

NPM version

Analyze Tzo code (Standard Representation and ConciseText formats) and emit various details/statistics/formats.

Currently, the main thing this does is analyze Tzo code and return a nice syntax tree.

Can also be used as a library and imported.

Running

  1. make sure you have dependencies installed: npm i
  2. npm run start -- --input <path to Tzo VMState .json or Tzo conciseText .txt file> --output out.json

to output a GraphViz .dot file for the Syntax Tree, use the --dot <PATH> parameter.

Unit tests

To run the unit tests: npm test

Example Syntax Tree graphs

(blue: function/opcode, black: literal, purple: block, green: root)

Hello world

"Hello" "," " world" rconcat rconcat

hello world example

if/else

1 1 + 2 eq dup jgz {
  "1 + 1 = 2!" pop
} jz {
  "1 + 1 is not 2!?"
}

if/else example

Readme

Keywords

none

Package Sidebar

Install

npm i tzo-analyze

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

88.2 kB

Total Files

47

Last publish

Collaborators

  • jorisd