[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua as a "domain specific language"?
- From: Thomas Wrensch <twrensch@...>
- Date: Thu, 23 Mar 2006 18:16:09 +0000 (UTC)
On Wed, 22 Mar 2006, PA wrote:
On Mar 10, 2006, at 01:19, Thomas Wrensch wrote:
I've also used Lua to build a very-high level modeling language for
object-oriented systems. This was a more traditional DSL for designers of
object-oriented software systems. Rather than using Lua's syntax directly
it implements a language parser in Lua.
I was wondering if you could provide some example of your modeling language?
How does it compare, relate to something like UML Object Constraint Language
(OCL)?
The language is a research prototype, and not ready for prime time. Here's
a quick overview for anyone else who is interested. Since this is
off-topic I'll send a more detailed description directly.
The idea is to build a model of a set of classes that can be interpreted
to create the classes themselves. For example, the following would build
simple BookTitle and Book classes with appropriate interaction between
them (this is the boring part, but is necessary background):
class(BookTitle)
class(Book)
value(Book.title, BookTitle)
value(BookTitle.author, String)
-- etc. as needed
The above is not much better than writing code in a decent OO language.
The value comes from the ability to define patterns of interaction. For
example, if BookTitle and Book cooperated to maintain a list in BookTitle
of all the Books that were of that type. (BookTitle contains a list of
Books):
manytoone(BookTitle.books, Book.title)
This declaration builds all the model elements necessary to make this
pattern work. Note that manytoone is not built in to the system, rather it
is defined by the user of the system or included in a library of such
definitions. Thus it has much of the power of RoR, but is easily
extensible.
And of course, all my research prototypes for this work (there are three
that test out different ideas) are written in Lua :-).
- Tom