|
Project Information
Members
Featured
Downloads
|
This is a project for an extensible parsing system that aims to provide a user-friendly method for designing composable DSLs. Languages are defined in modules by CFGs written in standard BNF notation. DSLs can be built on top of the Racket programming language by writing type-oriented grammar rules as function or macro signatures followed by Racket code for their implementation. For example, the rule Int ::= "|" s:Set "|" = (set-count s);defines syntax for set cardinality, which is implemented by Racket's set-count function. Installation To try out the tool, first download and install Racket from http://racket-lang.org/download. Then download and unzip the esc-0.1.zip file linked on the left side of this page, and enter the command: $ raco exe esc.rkt This creates a stand-alone executable esc that compiles extensible syntax files into Typed Racket code. Examples Included in the examples directory is a module for giving ML-like syntax to several Typed Racket forms (ML.es), and another for basic set operations such as the one above (Sets.es). import ML, Sets;
let A = {1, 2, 3} {
let B = {2, 3, 4} {
let C = {3, 4, 5} {
print |A & C|;
print A | B & C
}
}
} The above program (abc.es) can be compiled and run with the following commands: $ ./esc examples/abc.es $ racket -I typed/racket examples/abc.rkt The output of the program is 1 #<set: 1 2 3 4> |