joews / peach

A functional programming language
MIT License
3 stars 0 forks source link

Left-recursive grammar rules #44

Closed joews closed 7 years ago

joews commented 7 years ago

New grammar rules to fix #6, #22, #41 by adding binary operators, function calls and member access that can start with expressions.

That's quite a big grammar change because PEG parsers can't deal directly with left-recursive rules (i.e. an expression that starts with another expression like x + y).

Grammar

AST node types, type checker and interpreter

Other changes

The new syntax caused some ambiguities with parsing some variants of multi-clause functions. Multi-clause functions must now wrap argument patters in parentheses and use , to delimit clauses.

I'll try to refine this syntax in a later PR.