Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* GenLex stream parsers too eager?
@ 1999-01-26 17:33 David McClain
  1999-01-26 19:17 ` mattwb
  1999-02-01 13:13 ` Xavier Leroy
  0 siblings, 2 replies; 3+ messages in thread
From: David McClain @ 1999-01-26 17:33 UTC (permalink / raw)
  To: Liste CAML

It appears that the Genlex derived parsers always eagerly tokenize =
negaitve integer and float constants. This causes incorrect behavior in =
closely spaced code (no-spaces):

    a-2*c  --> parses as  "a", "-2" ,"*", "c"  instead of =
"a","-","2","*","c"

So instead of getting one expression tree, I get two, with the first =
containing only "a".
Also, if the operator were exponentiation instead of multiplication, the =
second tree would incorrectly compute a (possibly) complex valued =
expression instead of a simple negative of a real expression.

I have tried various workarounds, but they really obfuscate the original =
recursive descent structure of parsers.

Any suggestions? (Perhaps I should be using OCAMLLEX and OCAMLYACC =
instead?)

David McClain
Sr. Scientist
Raytheon Missile Systems Co.
Tucson, AZ
http://www.azstarnet.com/~dmcclain/homepage.htm





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

end of thread, other threads:[~1999-02-03 11:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-01-26 17:33 GenLex stream parsers too eager? David McClain
1999-01-26 19:17 ` mattwb
1999-02-01 13:13 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox