Enhanced C#
Language of your choice: library documentation
|
Macros for using LLLPG in LeMP. More...
Macros for using LLLPG in LeMP.
Example:
Up to three macros are used to invoke LLLPG.
LLLPG(lexer, {...})
and translate "lexer" to an unprintable literal of type IntStreamCodeGenHelper, and another macro for LLLPG(parser(Symbol, false), {...})"</c> that creates a
<see cref="GeneralCodeGenHelper"/> (this is the default helper).</li>
<li>The stage-one rule() macro uses <see cref="StageOneParser"/> to
translate token trees into expressions, e.g. <c>@[ ("Foo" | bar)* ~';' ]</c>
is currently translated to <c>@'tuple(@`'suf*`("Foo" | bar), ~';')
. Public static fields | |
static readonly Symbol | MacroNamespace = GSymbol.Get("Loyc.LLPG") |
Static Public Member Functions | |
static LNode | LLLPG_lexer (LNode node, IMacroContext context) |
Helper macro that translates lexer in LLLPG(lexer, {...}) into a IntStreamCodeGenHelper object. More... | |
static LNode | LLLPG_parser (LNode node, IMacroContext context) |
Helper macro that translates parser in LLLPG(parser, {...}) into a GeneralCodeGenHelper object. More... | |
static LNode | LllpgMacro (LNode node, IMacroContext context, Symbol expectedCodeGenMode, Func< LNode, IPGCodeGenHelper > makeCodeGenHelper, bool isDefault=false) |
This method helps do the stage-one transform from LLLPG (config) {...} to run_LLLPG (helper literal) {...} and also invokes the ANTLR-style parser if the second argument is a token literal. If node[0] calls expectedConfigNode then the delegate is called to construct a code generation helper object; otherwise, this method has no effect and returns null. More... | |
static LNode | rule (LNode node, IMacroContext context) |
static LNode | ECSharpRule (LNode node, IMacroContext context) |
static LNode | run_LLLPG (LNode node, IMacroContext context) |
|
inlinestatic |
Helper macro that translates lexer
in LLLPG(lexer, {...})
into a IntStreamCodeGenHelper object.
References LeMP.MacroContext.GetOptions(), Loyc.LLPG.Macros.LllpgMacro(), Loyc.Syntax.LNode.Missing, Loyc.Symbol.Name, LeMP.IMacroContext.Sink, and Loyc.Syntax.LNode.Value.
|
inlinestatic |
Helper macro that translates parser
in LLLPG(parser, {...})
into a GeneralCodeGenHelper object.
References LeMP.MacroContext.GetOptions(), Loyc.LLPG.Macros.LllpgMacro(), Loyc.Syntax.LNode.Missing, Loyc.Symbol.Name, LeMP.IMacroContext.Sink, and Loyc.Syntax.LNode.Value.
|
inlinestatic |
This method helps do the stage-one transform from LLLPG (config) {...}
to run_LLLPG (helper literal) {...}
and also invokes the ANTLR-style parser if the second argument is a token literal. If node[0]
calls expectedConfigNode
then the delegate is called to construct a code generation helper object; otherwise, this method has no effect and returns null.
References Loyc.Syntax.LNode.Args, LeMP.IMacroContext.Sink, Loyc.Syntax.LNode.Value, and Loyc.Syntax.CallNode.WithArgs().
Referenced by Loyc.LLPG.Macros.LLLPG_lexer(), and Loyc.LLPG.Macros.LLLPG_parser().