Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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/