Tuesday, December 23, 2008

DSL: How?

I just read a book about DSL(Domain Specific Language), a summary are written to get a general idea about DSL.

1. interpreter
write grammar using BNF or other grammar notations;
build or generate a parser of grammar(using tools like yacc, javacc, antlr)
script languages can be built in this way(template language like jsp,asp,freemarker,..)

2. embeded
build domain model by general purpose programming language
in a form of API specific to a domain
can be designed for considerable expression power within that domain(jMock)

3. XML
represent grammar by XML schema
processing XML is made easy by many API and tools
very popular in many domains:
definition of state transition in a state machine;
description of object relation mapping in OR Mapping tools
description of web page navigation flow
definition of business process(BPEL)

4. graphical DSL
represent domain model by constructing graph elements and their connections
more intuitive and impressive
graphical model can be transformed into software artifacts
XML is used for well integration with tools(XMI)

No comments: