caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamllex and python-style indentation
@ 2009-06-11 12:57 Andrej Bauer
  2009-06-11 13:12 ` [Caml-list] " yoann padioleau
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Andrej Bauer @ 2009-06-11 12:57 UTC (permalink / raw)
  To: caml-list

My parsing powers are not sufficient to easily come up with
lexer/parser for a simple language that uses python-style indentation
and newline rules. Does anyone have such a thing lying around, written
in ocamllex/yacc or menhir? I would appreciate a peek to see how
you've dealt with it.

For example, suppose we want just a very simple fragment of Python
involving True, False, conditional statements, variables, and
assignments, such as:

if True:
    x = 3
    y = (2 +
      4 + 5)
else:
    x = 5
    if False:
        x = 8
        z = 2

How would I go about writing a lexer/parser for such a thing in ocaml?

Andrej


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

end of thread, other threads:[~2009-07-01 16:27 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-11 12:57 ocamllex and python-style indentation Andrej Bauer
2009-06-11 13:12 ` [Caml-list] " yoann padioleau
2009-06-11 13:21 ` Andreas Rossberg
2009-06-11 13:44 ` Martin Jambon
2009-06-12  8:20   ` Andrej Bauer
2009-06-12 12:56     ` Martin Jambon
2009-06-12 13:34     ` Martin Jambon
2009-06-12 15:43     ` Andreas Rossberg
2009-06-30 18:58       ` Yitzhak Mandelbaum
2009-06-30 20:19         ` Mike Lin
2009-06-30 22:06         ` Andreas Rossberg
2009-07-01  2:13           ` Mike Lin
2009-07-01  7:31             ` Andreas Rossberg
2009-07-01 14:02               ` Mike Lin
2009-07-01 14:17                 ` Andreas Rossberg
2009-07-01 14:21                   ` Andreas Rossberg
2009-07-01 14:37                     ` Mike Lin
2009-07-01 15:03                   ` Sylvain Le Gall
2009-07-01 15:16                     ` [Caml-list] " Andreas Rossberg
2009-07-01 16:26                       ` Sylvain Le Gall
2009-07-01 15:19                     ` [Caml-list] " Martin Jambon
2009-07-01 15:43                       ` Andreas Rossberg

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).