caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* yacc question
@ 2005-12-04 14:15 skaller
  2005-12-04 15:03 ` [Caml-list] " Robert W.
  2005-12-04 15:25 ` Brian Hurt
  0 siblings, 2 replies; 5+ messages in thread
From: skaller @ 2005-12-04 14:15 UTC (permalink / raw)
  To: caml-list

I have the 'usual' kind of parser for expressions, with two
nonterminals 'expr' and 'atom', the latter including ( expr ) 
and INTEGER of course.

When I have input like

1;
1 + 2 ;
(1 + 2) ;

none of the case parse as expressions, the first and
last do parse as atoms (leaving the ; in the buffer).

What I want is to parse the longest possible match.
The only way I can think of doing this is:

top_expr:
  | expr token_not_allowed_in_expressions

and then 'put back' the trailing token into the buffer.
Is there another way?

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-04 16:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-04 14:15 yacc question skaller
2005-12-04 15:03 ` [Caml-list] " Robert W.
2005-12-04 16:46   ` skaller
2005-12-04 15:25 ` Brian Hurt
2005-12-04 16:37   ` skaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).