Hi, Joel, camlp4 will do the left factorization automatically.
Bob,
Since camlp4 is a recursive-descent parser, I don't think you can have "foo"; ... | "foo"; "bar".
On Nov 24, 2011, at 3:22 PM, bob zhang wrote:
> m_expr :
> [[ "foo"; f -> print_endline "first"
> | "foo" ; "bar"; "baz" -> print_endline "second"]
> ];
I would suggest having a single "foo" in the rule above and have a separate rule that branches depending on whether "bar" is found.
--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------