domain-specific-languages

writing a portable domain specific language

I'd like to know good strategies for deploying a domain-specific-language which must run under at least 2 languages (Java, C#) and probably more (Python, and possibly Javascript). Some background. We have developed and deployed a domain-specific language currently written in C#. It's deployed though a series of method calls whose argume...

Mini-languages in Python

I'm after creating a simple mini-language parser in Python, programming close to the problem domain and all that. Anyway, I was wondering how the people on here would go around doing that - what are the preferred ways of doing this kind of thing in Python? I'm not going to give specific details of what I'm after because at the moment ...

How should I construct a finance DSL?

I've decided to build a database tracking the credit card offers I get in the mail, and one confounding factor has been how to represent the offers. With minimum finance charges and variable rates and mimimum variable rates it gets a bit more complex than "10.99 percent". I've decided I need to construct a language to represent these thi...

Best design for generating code from an AST?

I'm working on a pretty complex DSL that I want to compile down into a few high level languages. The whole process has been a learning experience. The compiler is written in java. I was wondering if anyone knew a best practice for the design of the code generator portion. I currently have everything parsed into an abstract syntax tre...

How can I transform a functional language in XML to Java?

I'm working with a DSL based on an XML schema that supports functional language features such as loops, variable state with context, and calls to external Java classes. I'd like to write a tool which takes the XML document and converts it to, at the very least, something that looks like Java, where the <set> tags get converted to variabl...

Is it possible to evaluate a Ruby DSL in a non-global context?

I'm using Blockenspiel to create a DSL with Ruby. It works great and solves a lot of my problems, but I encountered the following problem that is not strictly related to Blockenspiel. Suppose I have a DSL that looks like this: dish do name = 'Pizza' ingredients = ... nutrition_facts = ... end dish do name = 'Doner' ingredie...

Coding a parser for a domain specific language in Java

We want to design a simple domain specific language for writing test scripts to automatically test a XML-based interface of one of our applications. A sample test would be: Get an input XML file from network shared folder or subversion repository Import the XML file using the interface Check if the import result message was successfull...

How to handle 'self' argument with Python decorators

I am trying to setup some decorators so that I can do something like: class Ball(object): def __init__(self, owner): self.owner = owner class Example(CommandSource): @command @when(lambda self, ball: ball.owner == self) def throwBall(self, ball): # code to throw the ball pass e = Example() ball...

how to develop domain specific language on top of another language ?

say i found a good open source software/library written in python. i want to wrap some of the functions or methods that i have created into easy to understand language of my own. do porter_stemm(DOC) (the DSL) would be equivalent to the function or series of methods written in python. i want to create a DSL that is easy to learn, but n...

how do closures help in creating a DSL/fluent interface: PHP examples?

Can you give me an example, in PHP, that shows how closures are helpful in creating a DSL (fluent interface)? edit: The accepted answer in the following question tells about nested closures. If someone could translate that example to PHP that would be helpful too: http://stackoverflow.com/questions/1966515/experience-with-fluent-interf...

Scala DSL without extra syntax

Hey, I asked myself this question a couple of times and came up with a solution for that feels very dirty. Maybe you can give me any advice since I think this is a basic problem for every DSL written in Scala. I want to have a hierarchical structure of nested objects without adding any extra syntax. Specs is a good example for this: M...

Hierarchical state machine implementation in Erlang

Hi! I am planning a turn based game (a sort of board game), and the backend will probably be done in Erlang. The game logic part seems to be a fit for a hierarchical state machine, but I'm not sure about how to implement that in Erlang. Maybe I can spawn a separate process with each child fsm, not sure if this would work. Another opti...

Meta-relationships on language-oriented programming.

In the process of developing a new language. How can be related the "high level" concepts such as "LALR parser", "abstract syntax tree", "context-free grammars", etc. with other "low level" concepts like the specific grammar rules "A -> B". I mean as some kind of metalanguage relationship, or similar. Any ideas or suggestions to look m...

Software Product Lines (SPL) for Domain Specific Languages (DSL)

Does it make sense to focus on Domain Specifics Languages (DSL) development following a Software Product Line approach? Does anyone know any other approach to create and maintain several related Domain Specifics Languages at the same time? Note that to support a custom language, requires support multiple tools, from parser, compilers, ...

Using adaptive grammars

Hi, I'm trying to implement a language (or family of languages) whose grammar can be changed dynamically. I have found no examples that serve as study cases. Can you give me some reference to any that are actually used in the real world (even from the academic world)? Does it make sense to implement a Domain-Specific Languages with a ...