robrix / Hammer

Parsing and pattern matching in Objective-C
BSD 3-Clause "New" or "Revised" License
75 stars 1 forks source link

Reducible grammars #73

Closed robrix closed 10 years ago

robrix commented 10 years ago

This implements a deep, eager, prefix-order, depth-first, acyclic traversal by conforming HMRCombinator to REDReducible.

Note that since this is a deep and eager traversal, the traversal of each individual node is unable to selectively traverse or ignore branches of alternations/concatenations, or to operate on the results of their subcombinators. Thus, parseNull cannot be implemented with this interface; it’s only suitable for trivial computations such as the size of the grammar or pretty-printing.

Fixes #57.