https://github.com/zserge/g2h
GoToHell - a very minimal programming language I used for my talk about compilers and interpreters
https://github.com/zserge/g2h
Last synced: about 1 year ago
JSON representation
GoToHell - a very minimal programming language I used for my talk about compilers and interpreters
- Host: GitHub
- URL: https://github.com/zserge/g2h
- Owner: zserge
- License: mit
- Created: 2015-09-12T10:15:00.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-12T10:24:14.000Z (over 10 years ago)
- Last Synced: 2025-01-24T11:11:15.323Z (over 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# g2h
GoToHell - a very minimal programming language I used for my talk about compilers and interpreters.
It uses PEG.js as a parser generator.
## G2H app example
```
count = 0
.loop if eq count 10 then goto end
print 'Count =' count
count = plus count 1
goto loop
.end
```
## Grammar
(It's not a real BNF form, it's just for better understanding)
line = label statement
| statement
| label
stmt = if | call
if = "if" call "then" call
call = id "=" call
| id arg arg...
| arg
arg = id | string | number
// Token types:
label = "." id
id = [a-zA-Z_][0-9a-zA-Z_]*
string = "'" [^']* "'"
number = [0-9]+
## Features
The language is very simple, it's interpeted, it's sources is about 100 LOC, so it's easy to read and to learn.
## License
Code is distributed under MIT license.