This is my little learn-by-doing
project to demonstrate and understand the basic concept of Pratt parsing.
This app is a Go
port of Bantam
, originally written in Java.
If you want to see the full explanation, check out this awesome blog post by Bob Nystrom.
Making my Go
version here, I tried to:
- keep the original structure of the project
- change some code to fit into idiomatic way of
Go
programming
Run the tests:
go run main.go
bantam-go/
├── tokentype/ # Token type definitions
├── token/ # Token structure
├── parser/ # Core parsing logic
├── parselet/ # Parsing rules for different expressions
├── lexer/ # Lexical analyzer
├── expression/ # Expression AST nodes
├── bantamparser/ # Bantam-specific parser configuration
└── main.go # Test runner