Hi, Joel, camlp4 will do the left factorization automatically.
It's weird because after factorization the order of the rule is changed and no documentation specify how the rules will be re-organized

2011/11/24 Joel Reymont <joelr1@gmail.com>
Bob,

On Nov 24, 2011, at 3:22 PM, bob zhang wrote:

> m_expr :
> [[ "foo"; f -> print_endline "first"
> | "foo" ; "bar"; "baz" -> print_endline "second"]
> ];


Since camlp4 is a recursive-descent parser, I don't think you can have "foo"; ... | "foo"; "bar".

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
---------------------+------------+---------------------------------------




--
Best, bob