caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Parser/lexer for block indented code
@ 2010-02-02  7:33 Andrej Bauer
  2010-02-02  8:37 ` [Caml-list] " blue storm
  2010-02-02  8:44 ` Yoann Padioleau
  0 siblings, 2 replies; 4+ messages in thread
From: Andrej Bauer @ 2010-02-02  7:33 UTC (permalink / raw)
  To: caml-list

Would anyone happen to have lying around parser/lexer for block
indented code (a la Python and Haskell)? I am using ocamlyacc or
menhir, whichever.

It seems to be the best way to do deal with this is to put a filter
between lexer and parser that inserts appropriate hints. I would like
to avoid reinventing the wheel, hints and advice are appreciated.

With kind regards,

Andrej


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

* Re: [Caml-list] Parser/lexer for block indented code
  2010-02-02  7:33 Parser/lexer for block indented code Andrej Bauer
@ 2010-02-02  8:37 ` blue storm
  2010-02-02  8:44 ` Yoann Padioleau
  1 sibling, 0 replies; 4+ messages in thread
From: blue storm @ 2010-02-02  8:37 UTC (permalink / raw)
  To: Andrej Bauer; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 738 bytes --]

There is "The Whitespace Thing" :
http://people.csail.mit.edu/mikelin/ocaml+twt/

I have tried to reproduce something similar using Camlp4 twice, the first
time with a ad-hoc grammar reusing as much as the current grammar as
possible, the second with the specific goal of compatibility with the F#
"#light" grammar.
Both projets have reached a "good enough to test and use privately" state,
but I haven't actually made the effort to release them (knowing virutally
nobody would use them anyway, because it's camlp4). In particular, the
"pa_light" attempt never reached full #light compatibility.

If you care, I could clean the up a bit (more than two years of bitrot, then
probably don't even compile anymore) and upload them somewhere.

[-- Attachment #2: Type: text/html, Size: 875 bytes --]

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

* Re: [Caml-list] Parser/lexer for block indented code
  2010-02-02  7:33 Parser/lexer for block indented code Andrej Bauer
  2010-02-02  8:37 ` [Caml-list] " blue storm
@ 2010-02-02  8:44 ` Yoann Padioleau
  2010-02-02  8:48   ` blue storm
  1 sibling, 1 reply; 4+ messages in thread
From: Yoann Padioleau @ 2010-02-02  8:44 UTC (permalink / raw)
  To: Andrej Bauer; +Cc: caml-list


On Feb 1, 2010, at 11:33 PM, Andrej Bauer wrote:

> 
> Would anyone happen to have lying around parser/lexer for block
> indented code (a la Python and Haskell)? I am using ocamlyacc or
> menhir, whichever.

There was some discussions about this in the past:

http://caml.inria.fr/pub/ml-archives/caml-list/2009/06/628f99a8b518acc3fc9f3649b1901167.en.html


google: ocaml layout indentation parsing


> 
> It seems to be the best way to do deal with this is to put a filter
> between lexer and parser that inserts appropriate hints. I would like
> to avoid reinventing the wheel, hints and advice are appreciated.
> 
> With kind regards,
> 
> Andrej
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 




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

* Re: [Caml-list] Parser/lexer for block indented code
  2010-02-02  8:44 ` Yoann Padioleau
@ 2010-02-02  8:48   ` blue storm
  0 siblings, 0 replies; 4+ messages in thread
From: blue storm @ 2010-02-02  8:48 UTC (permalink / raw)
  To: Yoann Padioleau; +Cc: Andrej Bauer, caml-list

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

Yes, it appears I have a bit over-interpreted the question. Parsers for
"generic" indentation-meaningful languages (not OCaml) have been discussed
there.
In particular, Andreas Rossberg has a working lexer in the layoutLexer.ml
file of http://www.mpi-sws.org/~rossberg/hocaml-0.12.tgz

[-- Attachment #2: Type: text/html, Size: 372 bytes --]

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

end of thread, other threads:[~2010-02-02  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-02  7:33 Parser/lexer for block indented code Andrej Bauer
2010-02-02  8:37 ` [Caml-list] " blue storm
2010-02-02  8:44 ` Yoann Padioleau
2010-02-02  8:48   ` blue storm

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