Goldie Homepage Documentation (v0.3) |
StaticLangGenerates a language package from a GOLD CGT file that can be embedded directly into a D program and used in either static-style or dynamic-style. Example:Suppose this scenario:
>staticlang langs/mylang.cgt -dir:src -pack:myapp.mylang
The above command will create the package myapp.mylang in directory ./src/myapp/mylang/. Then, to use the language (in either static-style or dynamic-style), include this line in the MyApp source: import myapp.mylang.all;Then, use the Language_ named language_mylang, like this: module myapp; import myapp.mylang.all; void main() { auto source = "...source code in 'mylang' language here..."; // Static-style: auto rootTokenStatic = language_mylang.parseCode(src).parseTree; // Dynamic-style: auto rootTokenDynamic = language_mylang.parseCodeX(src).parseTreeX; // rootTokenStatic is of type: Token_mylang!("<mylang's start symbol>") // (Look up 'Token_{languageName}!({symbol})' in Goldie's API Reference) // rootTokenDynamic is of type: Token }For an example of actually using the resulting parse tree, see the source code for the Included Sample Apps and the examples on the Static And Dynamic Styles page. Command-line parameters:Sample Usage: staticlang langs/lang.cgt Creates "goldie/staticlang/lang/*.d", each containing "module goldie.staticlang.lang.*;" staticlang langs/lang.cgt /dir:foo/src /pack:myapp.mylang Creates "foo/src/myapp/mylang/*.d", each containing "module myapp.mylang.*;" Switches: (Prefixes can be '/', '-' or '--') ('[]' means multiple switches are accepted) /help Displays a help summary and exits /detail Displays a detailed help message and exits <text> (Required) CGT language file to use /pack:<text> Name of output package (default: goldie.staticlang.{cgt}) /dir:<text> Directory of package root (default: current directory)See Also: |