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
Menhir and ocamlyacc: Ambiguous grammar
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-01 (19:16)
From: Joel Reymont <joelr1@g...>
Subject: Menhir and ocamlyacc: Ambiguous grammar
name_shares:
   | LP expr RP expr SHARES { (Some $2, `Qty $4) }
   | LP expr RP             { (Some $2, `All)    }
   | expr SHARES            { (None, `Qty $1)    }
   |                        { (None, `All)       }

This is intended to parse a "name" that is followed by the # of shares.

The problem is that expr itself can be LP expr LP in which case the  
only differentiator is the SHARES that follows.

Is there any way to parse this using ocamlyacc or Menhir?

	Thanks, Joel

--
http://wagerlabs.com/