From: Erik de Castro Lopo <ocaml-erikd@mega-nerd.com>
To: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] CFG's and OCaml
Date: Sat, 14 Aug 2004 10:57:51 +1000 [thread overview]
Message-ID: <20040814105751.22099f53.ocaml-erikd@mega-nerd.com> (raw)
In-Reply-To: <200408140125.59473.jon@jdh30.plus.com>
On Sat, 14 Aug 2004 01:25:59 +0100
Jon Harrop <jon@jdh30.plus.com> wrote:
>
> I have some (probably trivial) questions about parsers:
>
> 1. Are most programming languages designed to be implementable using
> lex and yacc?
Maybe not lex and yacc, but most are designed to be parsed by
LALR(1) parsers.
Currently the most difficult to parse language seems to be C++.
> 2. If so, are their designs restricted by this?
Unlikely.
> 3. If so, is the fact that most languages disallow "a<b<c" due to this?
This should be parsable by an LALR(1) parser.
Anyway, this is really just syntactic sugar for "a < b && b < c".
> 5. Is it productive to think in terms of coercing lex and yacc into doing as
> much of the work as possible and then using postprocessing to do the rest
> (e.g. this is the way I'd implement a<b<c)?
If a, b and c are ints, then the assember version of
if a<b<c then ....
would be exactly the same as:
if a < b && b < c then ....
Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
"Anyone who considers arithmetical methods of producing random
digits is, of course, in a state of sin." - John Von Neumann (1951)
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2004-08-14 0:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-13 14:04 David McClain
2004-08-13 15:05 ` Damien Doligez
2004-08-13 15:26 ` David McClain
2004-08-13 16:12 ` Damien Doligez
2004-08-13 15:28 ` David McClain
2004-08-13 15:49 ` Brian Hurt
2004-08-13 16:04 ` David McClain
2004-08-13 16:29 ` Brian Hurt
2004-08-13 16:42 ` Xavier Leroy
2004-08-13 17:18 ` Ken Rose
2004-08-13 18:55 ` Brian Hurt
2004-08-14 0:25 ` Jon Harrop
2004-08-14 0:57 ` Erik de Castro Lopo [this message]
2004-08-14 8:52 ` Alan Schmitt
2004-08-14 3:33 ` Brian Hurt
2004-08-14 7:55 ` skaller
2004-08-14 20:19 ` Jon Harrop
2004-08-14 20:55 ` Brian Hurt
2004-08-14 20:57 ` Marcin 'Qrczak' Kowalczyk
2004-08-14 22:15 ` skaller
2004-08-15 1:26 ` Jon Harrop
2004-08-15 8:24 ` skaller
2004-08-15 15:39 ` Brian Hurt
2004-08-15 16:54 ` Jon Harrop
2004-08-14 22:13 ` skaller
2004-08-13 16:58 ` Paul Snively
-- strict thread matches above, loose matches on Subject: below --
2004-08-12 19:15 David McClain
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=20040814105751.22099f53.ocaml-erikd@mega-nerd.com \
--to=ocaml-erikd@mega-nerd.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