Class mmir.env.grammar.PegJsGenerator
Defined in: pegjsGenerator.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Generator for executable language-grammars (i.e.
|
| Field Attributes | Field Name and Description |
|---|---|
|
The name/ID for the compile engine for the PEG.js compiler
|
| Method Attributes | Method Name and Description |
|---|---|
|
PegJsGenerator#init(callback)
|
Class Detail
mmir.env.grammar.PegJsGenerator()
Generator for executable language-grammars (i.e. converted JSON grammars).
This generator uses PEG.js for compiling the JSON grammar.
The generator for compiling the JSON grammar definitions in www/config/languages/<language code>/grammar.json
can be configured in www/config/configuration.json:
{
...
"grammarCompiler": "pegjs",
...
}
PEGjs supports grammar generation for: PEG (Parsing Expression Grammar) NOTE: PEG is a different formalism than "classical" context-free grammar definitions/formalisms; see also explanation of PEG in Wikipedia
- Requires:
- PEG.js
- jQuery.Deferred
- jQuery.extend
- jQuery.makeArray
- See:
- PEGjs homepage at http://pegjs.majda.cz/
Field Detail
PegJsGenerator#engineId
The name/ID for the compile engine for the PEG.js compiler
Method Detail
{Deferred}
PegJsGenerator#init(callback)
- Parameters:
- {Function} callback Optional
- OPTIONAL the callback that is triggered, when the engine is initialized
- Returns:
- {Deferred} a promise that is resolved, when the engine is initialized
(NOTE: if you use the same function for the
callbackAND the promise, then the function will be invoked twice!)