Hello people,
i'm writing a small preprocessor for a programming language.
I need to represent a program parsed tree in order to modify it during
execution. My basic idea was to define a type for each of grammar
product; so for example boolean expressions are represented by the
type:

type bool_expr = (* Represents boolexp and lboolexp *)
        | True
        | False
        | Not of bool_expr
        | And of bool_expr * bool_expr
        | Or of bool_expr * bool_expr ..........

The parsing is done by ocamllex/ocamlyacc which instantiate "objects"
of those types.

So far so good.

The problem is that i have *mutually recursive productions* in my
grammar:

ProductionA -> Something | SomethingSomething | ProductionB

ProductionB -> SomethingSomethingSomething | ProductionA

and i can NOT define mutually recursive types in ocaml (as far as i
understood by: http://pauillac.inria.fr/caml/caml-list/1393.html )

So which is the best solution to implement this ?
Any comments will be appreciated.

O(n)

-- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html

Reply via email to