Lambda the Ultimate

inactiveTopic Example little languages
started 11/23/2001; 2:52:36 PM - last post 11/26/2001; 4:41:15 AM
Ehud Lamm - Example little languages  blueArrow
11/23/2001; 2:52:36 PM (reads: 587, responses: 5)

I am looking for a good example of a little language. Something that can be easily implemented, and is clearly useful.

Any good ideas? (I don't need a specific language, though this can be nice, all I need is some specific domain suggestions).

Chris Rathman - Re: Example little languages  blueArrow
11/23/2001; 11:32:04 PM (reads: 613, responses: 0)
Don't know if it's the kind of example your looking for, but I ran across an interesting embedded application in a point-of-sales retail app. Though the application was written in a variety of programming languages across various platforms (C, C++, Java, VB, SQL, etc), the data itself had an encapsulated scripting language.

It was kind of an attempt at pseudo-OO programming where the data acted as objects with a little language acting as the encapsulated method for the object. The commands were domain specific with an interpreter written in each of the target platforms/languages. Meant that you could concentrate the little language strictly on the target domain by gearing it towards the functionality that was specific to financial transactions. Additional script could be added onto the object as the transaction process proceeded.

Don't know if that's a sufficient description, but the idea was to make the little language part of the data itself.

Ehud Lamm - Re: Example little languages  blueArrow
11/24/2001; 2:49:13 AM (reads: 611, responses: 0)
I am known to advocate using DSLs to achieve cross platform portability. I also think I understand what you mean when you talk about an OO-like scirpting language (you'd have domain specific objects accessible from the language, like you have in Javascript, right?)

But I am not sure what you mean when you say the idea was to make the little language part of the data itself.

The domain specific objects were programmed using the DSL itself, which wasn't just used for connecting the objects. That's nice. (I've seen this done a couple of times in some inhouse applications). But how does this relate to the data the system operates on?

Chris Rathman - Re: Example little languages  blueArrow
11/25/2001; 4:40:30 PM (reads: 615, responses: 0)
Just clarifying a tad. The language engine itself wasn't embedded within the data. Rather, the scripts the data effectively had scripts which acted as a processing language for the data. As the data traversed through the transaction process, additional script could be tacked onto the data structure for further processing.

The language was definitely domain specific and geared towards the particular application. Any language could be used to process the data, provided an engine was written to interpret the embedded script. JavaScript is an apt analogy, though that particular language is rather wide open in comparison - having to handle a much wider domain. The script, in essence, really was as much a part of the data as the 1's and 0's.

Noel Welsh - Re: Example little languages  blueArrow
11/26/2001; 2:57:33 AM (reads: 626, responses: 0)
Regular expressions are arguably little languages. There is a runtime interpreter (in most systems - you could statically compile them), they are domain specific and they are undeniably useful.

Ehud Lamm - Re: Example little languages  blueArrow
11/26/2001; 4:41:15 AM (reads: 617, responses: 0)
Thanks, Chris.

Noel, I was looking for a less techincal example, hopefully something that looks more like a regular language than RE.

For now I've been playing with a liitle language for describing lesson plans (basically something like an XML structure, but using Scheme syntax). Now I am trying to find a useful set of abstractions for programming such a thing.

Obviously, you can program the interpretation of the data using Scheme, essentialy making each lesson processor routine a lesson data type interpreter.

This however isn't very sexy. Since the language simply describes the course data, and doesn't provide real programming facilities.

I am thinking of perhpas adding a simple pattern matching language, ala AWK, so users can define actions specific to different kinds of lesson parts (e.g., how to handle questions, interactively or by displaying the qestion and answer on one HTML page).