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: 17 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 (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-16T23:07:26.000Z (almost 9 years ago)
- Last Synced: 2024-10-10T20:19:36.941Z (about 1 month 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.