Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "David McClain" <dmcclain@azstarnet.com>
To: "Liste CAML" <caml-list@inria.fr>
Subject: GenLex stream parsers too eager?
Date: Tue, 26 Jan 1999 10:33:46 -0700	[thread overview]
Message-ID: <000c01be4952$09752290$210148bf@dylan> (raw)

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





             reply	other threads:[~1999-01-26 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-26 17:33 David McClain [this message]
1999-01-26 19:17 ` mattwb
1999-02-01 13:13 ` Xavier Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000c01be4952$09752290$210148bf@dylan' \
    --to=dmcclain@azstarnet.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox