English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
yacc style
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-01-27 (20:17)
From: Chris King <colanderman@g...>
Subject: yacc style
I'm defining a grammar which, when parsed, returns an imperative
structure (i.e. one which can't easily be created in a functional
style).  ocamlyacc is making this difficult for me, since there's no
clean way to pass to the main parser function a structure on which to
operate.  Right now I'm getting around this by defining global
references in the header of the parser and setting them before each
call to the parser main function.  Is it considered better style to
instead have the parser return a parse tree, and then use that to
generate the imperative structure, or is there a more direct way to do
what I want to do?