[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extensible syntax


...seeking links / advice...

I'm currently working on a language that is extensible in the same way
that "Lisp is a programmable programming language". The intention is to
come up with a language that can easily morph into a wide range of DSLs.

Lisp/Scheme provide exactly this facility, but every DSL must have
Lisp's syntax. What about lisp-like extensibility, plus extensible
syntax - i.e. a fully extensible set of prefix/infix/postfix operators
and compound statements (e.g. control structures)?

There's Dylan, with its template based macro system, but Dylan syntax is
only extensible within a fairly strict framework. It always looks like
Dylan. Agree?

Then there's Smalltalk et al, using blocks to provide extensible control
structures, but again the syntax is highly constrained.

Haskell has extensible prefix and infix operators, with user control
over precedence. This gets you quite far. I once built an XPath like
library in Haskell that tried to mimic regular XPath syntax, but you can
only get part of the way there.

Of course there's a ton of preprocessors that allow one to extend a
languages grammar, but this is something of a heavyweight approach, and
may suffer from lack of modularity?? I'm after something lightweight and
built-in, similar to the way Lisp lets me just fire off a defmacro as
easily as a defun.

Also of great interest is the ability to freely embed DSLs inside each
other. I don't think I've seen this done (except in Lisp where the
syntax doesn't change).

Thoughts? Links?

Thanks very much.