A translator (in future - compiler) for fictional programming language - ZitRo language.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
modules
tests
README.md
execute.js
package.json
runTests.js
translate.js

README.md

ZitRoLanguage translator

A translator (in future - compiler) for fictional programming language - ZitRo language.

Running

To translate and compile the program, run command this way: node translate path/to/file.zrl Also you can specify additional parameters to change syntax analyzer analyze method, try node translate path/to/file.zrl -analyzeMethod 2 (also available -analyzeMethod 1)

Follow this guide:
  1. Run translator with node translate test.zrl -analyzeMethod 2 (for example);
  2. Make sure "program.zre" file has been created at test directory. If some errors occur, check the test/translate.html file contents and console output.
  3. Run node execute test/program to execute program.

Testing

Run unit tests with node runTests command.

Example

Contents of test.zrl file:

module test {
    var: a, b, c, d
    start
        b = 3;
        a = 2;
        if [[a != (b + 10)] or not [b == 1] or [a <= 2]] or [not 1 >= 1] then
        for c=1 to b by a while [c >= 10] or [a < 5] do
            for d=1 to b by a while d <= 10 do
                output: c, d
            end
        end;
        output: a
    end
}
  1. node translate test.zrl -analyzeMethod 2
  2. node execute test/program

Output:

1, 1
1, 3
3, 1
3, 3
2