C# Class Loyc.LLParserGenerator.LLParserGenerator.GenerateCodeVisitor

Directs code generation using the visitor pattern to visit the predicates in a rule. The process starts with Generate(Rule).
This class is in charge of high-level code generation. It relies on IPGCodeGenHelper for most low-level code generation tasks.
Inheritance: Loyc.LLParserGenerator.PredVisitor
Exibir arquivo Open project: qwertie/ecsharp

Public Properties

Property Type Description
F Loyc.Syntax.LNodeFactory
LLPG LLParserGenerator

Private Properties

Property Type Description
AddUserAction void
DeduplicateLabels void
GenerateCodeForAlts void
GenerateExtraMatchingCode WList
GenerateIfElseChain LNode
GenerateTest LNode
GenerateTest LNode
GetAndPredCode LNode
GetContinueStmt LNode
GetExitStmt LNode
Join LNode
NextStopLabel string
SimpleEnoughToRepeat bool

Public Methods

Method Description
Generate ( Rule rule ) : void
GenerateCodeVisitor ( LLParserGenerator llpg ) : System
Visit ( Alts alts ) : void

Visit(Alts) is the most important method in this class. It generates all prediction code, which is the majority of the code in a parser.

Visit ( AndPred andp ) : void
Visit ( Gate pred ) : void
Visit ( Pred pred ) : void
Visit ( RuleRef rref ) : void
Visit ( Seq pred ) : void
Visit ( TerminalPred term ) : void
VisitWithNewTarget ( Pred toBeVisited, WList target ) : void

Protected Methods

Method Description
GeneratePredictionTreeCode ( PredictionTree tree, string>.Pair matchingCode, Symbol &haveLoop ) : LNode
GetPredictionSubtreeCode ( PredictionBranch branch, string>.Pair matchingCode, Symbol &haveLoop ) : LNode

Private Methods

Method Description
AddUserAction ( LNode action ) : void
DeduplicateLabels ( string>.Pair matchingCode ) : void
GenerateCodeForAlts ( Alts alts, int>.Dictionary timesUsed, PredictionTree tree ) : void
GenerateExtraMatchingCode ( string>.Pair matchingCode, int separateCount, Symbol &loopType ) : WList
GenerateIfElseChain ( PredictionTree tree, LNode branchCode, LNode &laVar, MSet switchCases ) : LNode
GenerateTest ( List andPreds, int lookaheadAmt, LNode laVar ) : LNode
GenerateTest ( Set andPreds, int lookaheadAmt, LNode laVar ) : LNode
GetAndPredCode ( AndPred pred, int lookaheadAmt, LNode laVar ) : LNode
GetContinueStmt ( Symbol loopType ) : LNode
GetExitStmt ( Symbol haveLoop ) : LNode
Join ( IEnumerable nodes, Symbol op, LNode @default ) : LNode
NextStopLabel ( ) : string
SimpleEnoughToRepeat ( LNode code ) : bool

Method Details

Generate() public method

public Generate ( Rule rule ) : void
rule Rule
return void

GenerateCodeVisitor() public method

public GenerateCodeVisitor ( LLParserGenerator llpg ) : System
llpg LLParserGenerator
return System

GeneratePredictionTreeCode() protected method

protected GeneratePredictionTreeCode ( PredictionTree tree, string>.Pair matchingCode, Symbol &haveLoop ) : LNode
tree PredictionTree
matchingCode string>.Pair
haveLoop Symbol
return LNode

GetPredictionSubtreeCode() protected method

protected GetPredictionSubtreeCode ( PredictionBranch branch, string>.Pair matchingCode, Symbol &haveLoop ) : LNode
branch PredictionBranch
matchingCode string>.Pair
haveLoop Symbol
return LNode

Visit() public method

Visit(Alts) is the most important method in this class. It generates all prediction code, which is the majority of the code in a parser.
public Visit ( Alts alts ) : void
alts Alts
return void

Visit() public method

public Visit ( AndPred andp ) : void
andp AndPred
return void

Visit() public method

public Visit ( Gate pred ) : void
pred Gate
return void

Visit() public method

public Visit ( Pred pred ) : void
pred Pred
return void

Visit() public method

public Visit ( RuleRef rref ) : void
rref RuleRef
return void

Visit() public method

public Visit ( Seq pred ) : void
pred Seq
return void

Visit() public method

public Visit ( TerminalPred term ) : void
term TerminalPred
return void

VisitWithNewTarget() public method

public VisitWithNewTarget ( Pred toBeVisited, WList target ) : void
toBeVisited Pred
target WList
return void

Property Details

F public_oe property

public LNodeFactory,Loyc.Syntax F
return Loyc.Syntax.LNodeFactory

LLPG public_oe property

public LLParserGenerator LLPG
return LLParserGenerator