Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/steveklabnik/grok
Fun with compilers, interpreters and such.
https://github.com/steveklabnik/grok
Last synced: 7 days ago
JSON representation
Fun with compilers, interpreters and such.
- Host: GitHub
- URL: https://github.com/steveklabnik/grok
- Owner: steveklabnik
- Created: 2015-11-16T00:10:44.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-16T23:07:26.000Z (about 9 years ago)
- Last Synced: 2024-12-01T19:36:25.274Z (22 days ago)
- Language: Rust
- Homepage: https://github.com/steveklabnik/grok
- Size: 21.5 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Grok
Fun with compilers, interpereters, and such.
## Language
Grok is a few things:
1. A simple language. Integer, plus or minus, then integer.
2. An interpreter/emulator. Kinda looks like a made-up CPU.
3. The assembly/bytecode for that CPU.## Commands
* `rungrok`: take a grok program and run it
* `grokc`: take a grok program and spit out assembly/bytecode
* `grok`: take assembly/bytecode and execute it
* `grokdb`: take assembly/bytecode and step through like a debugger## Instructions
`grok` is a machine with three registers, `a`, `b`, and `c`. There’s also a
program counter, `pc`, that you can just observe, not do anything with. Yet.Instructions:
* `set reg val`: set the register `reg` to the value `val`
* `set reg1 reg2`: set the register `reg1` to the value of `reg2`
* `increment reg`: increment the register `reg`
* `decrement reg`: decrement the register `reg`That’s it, for now.