Idorobots / spartan

A small Lisp dialect that serves me as a test bed for programming language features.
MIT License
13 stars 3 forks source link

PEG rule optimization pass #171

Closed Idorobots closed 2 years ago

Idorobots commented 2 years ago

The parser generator currently attempts to inline short rules to avoid unnecessary function calls, but it completely does not perm any rule simplification. There are some low hanging fruit available, provided the rules don't have a transform attached:

(a (b c) d) => (a b c d)
(/ a (/ b c) d) => (/ a b c d)
("reg" "ex") => "\(reg\)\(ex\)"

Related to #76