A Peek into Pugs Internals #47

Parsing terms

rule term
    { undef            : { return VUndef    }
    | (\d+)            : { return VInt($0)  }
    }

rule expr
    { <term>           : { return Val($term) }
    | $<lhs> := <expr>
                <operator>
      $<rhs> := <expr>
                       : { return Op(Val($<operator>), $<lhs>, $<rhs>) }
    }
continued...
Copyright © 2006 Gaal Yahas