Hi .. 

 On Thursday 27 January 2005 03:56, Hugh Sasse Staff Elec Eng wrote:
> On Thu, 27 Jan 2005, Clifford Heath wrote:
> >
> > ANTLR does LL(n) for arbitrary n I believe - though you should avoid
> > n > 3 or humans start to have trouble parsing your language :-).
> >
> > It's a shame that the ANTLR folk at Purdue went Java-only when they
> > dropped their old C-based implementation. A multi-lingual ANTLR would
> > be super-cool, especially if it would generate Ruby.
>
> There is also PCCTS
>
PCCTS was the predecessor of ANTLR.  I haven't played with either for quite 
some time but I seem to remember that PCCTS is written in C and could 
generate C or C++, whilst ANTLR is in Java and generates Java, C, C++ and C#.  
Also, I think that Dr Parr rolled the lexer into ANTLR in release 2 (a la 
Coco).

A quick search turned up a few other LL(k) generators, though most seem to be 
directed at Java and C#.

>
> but, although very flexible, it is not what I'd call simple. 
>
That's why I liked Coco/R.  A single pass lexer/scanner and a "readable" 
grammar.  Plus it is fast and efficient.  

> >> As an example, Ruby can not, as far as I have tried, be converted into
> >> an LL(1) grammar, though C can.
> >
> > Not without a tie-in to the lexical analyser to help recognise goto
> > labels, which require LL(2). Such a tie-in is commonly used however.
> >

For most of my work, the LL(1) restriction hasn't been an issue.  The only 
problem came when I tried to parse Ruby code for fun.  Not that I need to do 
that for real, after all, there is eval() ;-)

> > Such a tool, integrated into the Ruby interpreter itself, would
> > allow extension modules to define *Ruby syntax extensions*, so
> > that the language itself becomes plastic.
> >
> > I haven't thought much about what these last two features would
> > look like in Ruby's case.
> 
Forth?  ;-)  it's a case of back to the future ..

Regards,

-- 
-mark.  (probertm at acm dot org)