https://github.com/jsmonk/guu-graal
Implementation of Guu lang in Truffle Framwork
https://github.com/jsmonk/guu-graal
Last synced: 9 months ago
JSON representation
Implementation of Guu lang in Truffle Framwork
- Host: GitHub
- URL: https://github.com/jsmonk/guu-graal
- Owner: JSMonk
- Created: 2020-12-13T19:28:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-12-20T10:28:23.000Z (over 5 years ago)
- Last Synced: 2025-03-12T01:32:45.202Z (over 1 year ago)
- Language: Java
- Size: 18.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TruffleGuu
simple AST interpreter for Guu language
Guu program is a collection of procedures. Every procedure begins with the `sub` keyword and the name of the procedure and ends with other procedure declaration (or with file end if the procedure is final). Execution starts from the `main` procedure
A procedure body is an instructions sequence. At the start of a line can be any count of spaces and tabs. Empty lines should be ignored.
Guu has a one line comment blocks with `#` symbol.
Guu has only three statements:
- `set (varname) (new value)` - set a new value to variable.
- `call (subname)` - call a procedure (calls can be recursive).
- `print (varname)` - print a value of variable.
Variables in Guu language exist only in the global scope. So, the next program will print `2`:
```
# this is `main` procedure
sub main:
set a 1 # create `a` variable
call foo # call procedure
print a # print expression
# this is procedure which is called in `main` procedure
sub foo:
set a 2 # assign 2 as `a` variable value
```