robrix / Hammer

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

Simple DSL for nonterminals #88

Closed robrix closed 10 years ago

robrix commented 10 years ago
HMRMap(HMRAnd(HMREqual(x), HMRContain(y)), f)

is not super idiomatic/readable.

[[HMREqual(x) and:HMRContain(y)] map:f]

is better.

Simplifying terminals is slightly trickier. May just want to expose the class names:

[[[HMREqual :x] and:[HMRContain :y] map:f]

(I’m not seriously suggesting : as the selector, I’m just not sure what it should be.)

robrix commented 10 years ago

x.hmr_literal