Re: [Haskell-cafe] The Layout Rule

2012-06-21 Thread Tillmann Rendel

Hi Michael,

Michael D. Adams wrote:

I am looking for background material on how GHC and other Haskell
compilers implement the layout rule.


In the context of our work on syntactic extensibility, we have 
implemented a declarative and extensible mechanism to specify and 
implement layout rules. A paper about the approach is currently under 
review, and a draft is available [1]. The implementation and evaluation 
data is available [2].


 [1] http://sugarj.org/layout-parsing.pdf
 [2] http://github.com/seba--/layout-parsing

We used our parser in the implementation of SugarHaskell, a 
syntactically extensible variant of Haskell. A paper about SugarHaskell 
is currently under review, and again, a draft is available [3].
The implementation can be installed as an Eclipse plugin from the SugarJ 
website [4]. A command-line version is forthcoming.


 [3] http://sugarj.org/sugarhaskell.pdf
 [4] http://sugarj.org/

Best Regards,

 Tillmann (on behalf of the SugarJ team)

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] The Layout Rule

2012-06-19 Thread Michael D. Adams
I am looking for background material on how GHC and other Haskell
compilers implement the layout rule.  Are there any papers,
documentation, commentary, etc. that discus the actual implementation
of this rule (even if only a paragraph or two)?

I've already looked at the parsing code in GHC and UHC.  Do any other
Haskell compilers have interesting approaches for implementing the
layout rule?

I am writing a paper about a new formalism for indentation sensitive
languages and I want to ensure I've covered the appropriate background
material on existing implementations of the layout rule.

Michael D. Adams

mdmko...@gmail.com

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] New Layout Rule take 2

2006-12-09 Thread John Meacham
I have made some improvements to the algorithm, and I am happy to say
that with some minor tweaks, it correctly lays out the programs in the
nofib suite.

the algorithm is not much more complicated than the current one in the
report, but doesn't have the parse-error rule. it does require a single
token of lookahead to look for an in.

darcs get http://repetae.net/repos/getlaid/

I have also added a mode so it can work as a ghc preprocesor, allowing
very easy testing. just compile with.

ghc -pgmF /path/to/getlaid -F --make Main.hs

and it will automatically process all your files.


Now, it isn't perfect. I can construct pathological examples that the
old rule would parse, but this one won't. however, if those examples
don't actually occur in practice, then that is not so much an issue.

my program doesn't handle many non-haskell 98 extensions, but can
probably be easily modified to do so.

John
-- 
John Meacham - ⑆repetae.net⑆john⑈
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Layout rule (was Re: PrefixMap: code review request)

2006-03-02 Thread Ben Rudiak-Gould

I wrote:
I just installed Visual Haskell 0.1, and when I type in the 
editor, CPU usage rises to about 70% and there's a noticeable delay 
before each character appears on the screen.


This is no longer happening, so I guess I ran afoul of a bug.

-- Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Layout rule (was Re: PrefixMap: code review request)

2006-03-01 Thread Ben Rudiak-Gould

Duncan Coutts wrote:

hIDE and Visual Haskell use the ghc lexer and get near-instantaneous
syntax highlighting.


Hmm... I just installed Visual Haskell 0.1, and when I type in the editor, 
CPU usage rises to about 70% and there's a noticeable delay before each 
character appears on the screen. This is a very short module (~100 lines) 
and a Pentium M 1600 CPU. Am I doing something wrong?


-- Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Layout rule (was Re: PrefixMap: code review request)

2006-03-01 Thread Ben Rudiak-Gould

Benjamin Franksen wrote:

TAB characters in program text should be forbidden by law.


Well... they are quite useful for lining things up if you're using a 
proportional font, and I don't think proportionally-spaced code is a bad 
idea. I want them to be optional. But it would be nice if parsers would warn 
about (or even reject) programs whose meaning depends on tab width.


-- Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Layout rule

2006-03-01 Thread Ben Rudiak-Gould

Ketil Malde wrote:

Multi line comments are nice for commenting out blocks of code.


They're also nice for comments within a line. E.g. haskell-src-exts contains 
the declaration


  data HsQualConDecl
  = HsQualConDecl SrcLoc
  {- forall -} [HsName] {- . -} HsContext {- = -} HsConDecl

Probably half of my uses of {- -} begin and end on the same line.

-- Ben

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Layout rule (was Re: PrefixMap: code review request)

2006-03-01 Thread Duncan Coutts
On Wed, 2006-03-01 at 22:58 +, Ben Rudiak-Gould wrote:
 Duncan Coutts wrote:
  hIDE and Visual Haskell use the ghc lexer and get near-instantaneous
  syntax highlighting.
 
 Hmm... I just installed Visual Haskell 0.1, and when I type in the editor, 
 CPU usage rises to about 70% and there's a noticeable delay before each 
 character appears on the screen. This is a very short module (~100 lines) 
 and a Pentium M 1600 CPU. Am I doing something wrong?

I can't say too much about the internals of VH since I've not see the
code, only the description.

Perhaps that's because they're starting the parser immediately after
every keystroke and/or not killing the parser when the user types
another key. I've been using hIDE on a Pentium M 1600 laptop and on the
size of modules I've tried so far it's quick. The syntax highlighting
updates immediately and the type checker shows up errors a second or so
after I stop typing (which is because we wait about that long before
starting the parser).

Duncan

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe