jfcardinal / BantamCs

A port of Bantam (Java) by Robert Nystrom to C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a C# port of "Bantam". According to its README, bantam "is a tiny little Java app to demonstrate Pratt parsing. For a full explanation, see this blog post."

When researching Pratt parsers, I found Bob Nystrom's blog post Pratt Parsers: Expression Parsing Made Easy (linked above) and thought it was one of the best articles on the subject. He uses Java for its examples and the complete program is in https://github.com/munificent/bantam. I decided to port the Java example to C# because that's the language I'll be using for my first Pratt-based parser.

The C# version here is pretty faithful to the original. I am not a Java expert so perhaps I introduced inadvertent changes; the last serious work I did in Java was in the last century. Also, I was influenced by another great article on the subject by Aleksey Kladov Simple but Powerful Pratt Parsing. In particular, I think Aleksey's use of "binding power" to describe and implement precedence simplifies the core concept and so I switched to that terminology when porting Bantam.

About

A port of Bantam (Java) by Robert Nystrom to C#

License:Other


Languages

Language:C# 100.0%