SdfOption
Introduction
When writing a grammar using Projects.SDF (the Syntax Definition Formalism), optional literals are a very convenient construct. The problem is that they can not be manipulated in abstract syntax trees, because they can not be assigned a constructor name.
sdf-option introduces intermediate non-terminals to remove optional literals.
How does it work?
Source:
::? NestedNameSpec? ClassName -> BaseSpec
virtual AccessSpec? ::? NestedNameSpec? ClassName -> BaseSpec
AccessSpec virtual? ::? NestedNameSpec? ClassName -> BaseSpec
After optional literals removing:
virtual -> Dummy7
:: -> Dummy0
Dummy0? NestedNameSpec? ClassName -> BaseSpec
virtual AccessSpec? Dummy0? NestedNameSpec? ClassName -> BaseSpec
AccessSpec Dummy7? Dummy0? NestedNameSpec? ClassName -> BaseSpec
Usage
$ parse-sdf-definition -i grammar.def | \
sdf-option | \
pp-sdf -o grammar-no-opt.def
Installation
Dependencies
You need
StrategoXT 0.9.1.
Download
You can download the last tarball at:
sdf-option-0.1.tar.bz2: sdf-option v0.1
Compilation
Untar the tarball. Then in the tarball directory, type:
$ ./configure --with-xt=<PATH> --prefix=<PATH>
$ make
$ make install
Do not forget to change
"<PATH>" to your values.
to top
Transformers.SdfOption moved from Projects.SdfOption on 21 Dec 2004 - 17:12 by ClementVasseur? -
put it back