https://github.com/kx0101/liakos-language
Writing An Interpreter (Tree-Walking) In Go from scratch, using Vaughan Pratt's Parser For Educational Purposes
https://github.com/kx0101/liakos-language
ast expressions go golang identifiers interpreter lexer parser pratt-parser repl statements tokenizer tokens vaughan-pratt
Last synced: 10 months ago
JSON representation
Writing An Interpreter (Tree-Walking) In Go from scratch, using Vaughan Pratt's Parser For Educational Purposes
- Host: GitHub
- URL: https://github.com/kx0101/liakos-language
- Owner: kx0101
- Created: 2024-11-03T09:54:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-25T21:18:49.000Z (10 months ago)
- Last Synced: 2025-07-26T04:35:19.602Z (10 months ago)
- Topics: ast, expressions, go, golang, identifiers, interpreter, lexer, parser, pratt-parser, repl, statements, tokenizer, tokens, vaughan-pratt
- Language: Go
- Homepage:
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
- **REPL (Read-Eval-Print Loop)**
- **Primitive Types**: `int`, `bool`, `string`
- **Data Structures**: Arrays (`[]`) & Hash maps (`{}`)
- **Arithmetic Expressions**: `+`, `-`, `*`, `/`, `<`, `>`, `==`, `!=`
- **Variables & Bindings**: `let` statements
- **Control Flow**: `if-else`, `return`
- **Functions**:
- First-class & higher-order
- Closures & lexical scoping
- Recursion supported
- **Built-in Functions**: e.g. `len()`, `first()`, `last()`, `push()`, `print()`
- **Parser with Pratt Parsing** for correct operator precedence
- **Error Handling** with informative messages
- **Lexical Analyzer** (Tokenizer) and recursive descent parser
## 🚀 Getting Started
### 1. Clone the repo
```bash
git clone https://github.com/kx0101/liakos-language.git
cd liakos-language
```
## REPL
```bash
go run main.go
>> let add = fn(a, b) { return a + b; };
>> add(2, 3);
5
```
## Run a File
You can also execute `.liakos` source files:
```bash
./liakos examples/main.liakos
```