Several DSL examples implemented based on the boo language can be used as a reference for our learning.
Brail
Castle Project
Http://www.castleproject.org/monorail/documentation/trunk/viewengines/brail/index.html.
It's a text templating language, built by me, in which in you can mix code and text freely. Here's a sample:
<H1> my name is $ {name}
<Ul>
<% For element in list: %>
<Li >$ {element} </LI>
<% End %>
</Ul>
Rhino ETL
Rhino ETL employs the concept of steps, with data flowing from one step to the next.
Usually the first step will extract the data from some source, and the last will load it
The final destination.
Here's an example of a full ETL process:
Operationsplit_name:
For row in rows:
Continue if row. Name is null
Row. firstname, row. lastname = row. Name. Split ()
Yield row
Processuserstopeople:
Input "source_db", command = "select ID, name, email from users"
Split_names ()
Output "destination_db", command = """
Insert into people (userid, firstname, lastname, email)
Values (@ userid, @ firstname, @ lastname, @ email)
""":
Row. userid = row. ID
This code gets the users list from the source database, splits the names, and then saves
Them to the destination database. This is a good example of a DSL that requires some
Knowledge of the domain before you can utilize it.
Http://www.ayende.com/Blog/category/545.aspx
Bake (BOO build system)
Task "init build dir ":
If not directory. exists ("build "):
Mkdir "build"
Cpfileset ("lib/*. dll"). Files, "Build", true
Http://code.google.com/p/boo-build-system/
Specter
Specter is a behavior-driven development (BDD) Testing Framework
Context "Empty stack ":
Stack as stack
Setup:
Stack = stack ()
Specifystack. Count. Must = 0
Specify "stack must accept an item and count is then one ":
Stack. Push (42)
Stack. Count. Must = 1
Http://behaviour-driven.org/
Http://specter.sourceforge.net/