Skip to content

gozeloglu/pratt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pratt

The pratt command is a stripped-down expression parser based on the Pratt parser. To help understand Pratt parsing, the command also provides a naive, recursive, right-associative expression parser and a naive, iterative, left-associative expression parser.

Try it with:

go run ./main.go '1 + 2 * 3'

svg command

The svg command is meant to be used with the pratt command. It generates and opens an SVG image of the expression tree in the default SVG viewer.

Try it with:

go install ./...
pratt '1 * 2 + 3 * 4' | svg -o

Installation

You can install by using the following command.

go install github.com/gozeloglu/pratt@latest

Credit

Thanks to @juliaogris for this tool. Also, thanks to her for letting me improve new features.

LICENSE

MIT

About

A minimal Pratt parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 75.3%
  • Shell 23.7%
  • HCL 1.0%