[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Erik de Castro Lopo <ocaml-erikd@m...> |
| Subject: | Re: [Caml-list] CFG's and OCaml |
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