The problem is FsYacc simply doesn't support what you want to do. Unfortunatly you have to unroll into a second non-terminal clause. The best guide to what you can do in fsyacc is still the ocamlyacc manual:
[link:caml.inria.fr]

Thanks,
Rob

By on 11/27/2007 7:18 AM ()

Hi Robert,

Thanks for the reply. In fact, part of what I don't get is exactly due to the ocamllex/ocamlyacc manual.

On section 12.2.4 it is stated that

( regexp )
Match the same strings as regexp.

regexp +
(Strict repetition.) Match the concatenation of one or more strings that match regexp.

regexp *
(Repetition.) Match the concatenation of zero or more strings that match regexp.

So what I expected is that FsYacc followed that. You say it does not.

It would help a lot if there was some doc saying what parts of ocamllex/ocamlyacc manual are actually implemented by fslex/fsyacc and what parts are not. Is there such information anywhere?

Thanks again.

By on 11/27/2007 7:36 AM ()

Section 12.2.4 actually refers to the lexer and these rules are implemented for the lexer, it's section 12.4.3 that describes the grammar of ocamlyacc parser rules.

Though I agree fslex/fsyacc are very lacking in documentation and even the documentation for ocamllex/ocamlyacc isn't that great. I generally end up searching in the parser sample or in the compiler itself for bits of grammar which are similar to what I want to do, which isn't ideal.

By on 11/27/2007 8:09 AM ()

Hi Robert,

Silly mistake of mine. Thanks very much for helping again.

Cheers.

By on 11/27/2007 2:46 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper