Lambda the Ultimate

inactiveTopic Maya - Syntax extension for Java
started 8/31/2001; 9:42:13 AM - last post 9/5/2001; 8:44:11 AM
Bryn Keller - Maya - Syntax extension for Java  blueArrow
8/31/2001; 9:42:13 AM (reads: 2589, responses: 5)
Maya - Syntax extension for Java
Maya is a version of Java that allows users to write their own syntax extensions, which are called Mayans. Mayans can reinterpret or extend Maya syntax by expanding it to other Maya syntax: they operate on abstract syntax trees, and their expansion is triggered during parsing as semantic actions. Maya's expressiveness comes from treating grammar productions as generic functions, and Mayans as multi-methods on those generic functions...

There's a paper describing the system, and a software download should be available soon. Looks interesting. Does anyone have experience with languages or tools which permit custom syntax that they'd care to share? (Open{Java,C++}, Camlp4, macro-based systems, etc...)
Posted to OOP by Bryn Keller on 8/31/01; 9:59:16 AM

Ehud Lamm - Re: Maya - Syntax extension for Java  blueArrow
9/1/2001; 11:30:09 AM (reads: 1498, responses: 0)
Seems to me common wisdom is that extending syntax leads to readbility problems, and makes integrating modules harder.

Exending syntax is related to the concept of little languages, and to stratified design in general. The Scheme crowd did a lot of work on these issues, as part of the design of the Scheme macro system (Dybvig has interesting dicussions here and here).

jon fernquest - Re: Maya - Syntax extension for Java  blueArrow
9/2/2001; 8:41:24 AM (reads: 1500, responses: 0)

>Seems to me common wisdom is that extending syntax leads
>to readability problems, and makes integrating modules harder.

But when there is a *syntax that is traditionally used* for what you're doing it seems to *increase readability*.

For instance, when you embed a "Logic Programming Engine" . I think it's better to provide *the syntax that is traditionally used to write these types of programs*, namely Prolog Syntax.

This makes the logic engine in a recent book on parsing in Java more useful:

Building Parsers With Java (2001) Steven John Metsker

http://www.aw.com/product/0,2627,0201719622,00.html

And Schelog with a unique s-expression syntax that you have to learn from scratch less useable than it could be:

http://www.cs.rice.edu/CS/PLT/packages/schelog/

It's syntactic sugar leaves a bad after-taste. ;)

Cheers,

Jon Fernquest

Generic programming: one syntax -> multiple semantics ?
.NET Common Language Runtime: many syntaxes -> one semantics ?

Ehud Lamm - Re: Maya - Syntax extension for Java  blueArrow
9/3/2001; 6:53:45 AM (reads: 1509, responses: 0)
What I'd normally try to do in such situations is create a multi-language application. An example might be using a Prolog engine, from a C program. Most often this is better than what you describe since it relieves you from having to deal with the details a language implementation, and since it is likely to result in using a standard language rather than a clone.

This is not to say that I don't find the tools you mentioned to be quite cool...

Ehud Lamm - Re: Maya - Syntax extension for Java  blueArrow
9/4/2001; 5:21:58 AM (reads: 1492, responses: 0)
Can any one say something interesting about the book mentioned above? From the ToC, it seems to cover much more than what usually comes under the term 'parsers'.

Ehud Lamm - Re: Maya - Syntax extension for Java  blueArrow
9/5/2001; 8:44:11 AM (reads: 1452, responses: 0)
Browsing Dybvig, I cam across this example which I find very elegant. It would be interesting to see if this approach can be adapted to Maya.