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
Afficher le fichier Open project: qwertie/ecsharp

Méthodes publiques

Свойство Type Description
F Loyc.Syntax.LNodeFactory
LLPG LLParserGenerator

Private Properties

Свойство 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

Méthodes publiques

Méthode 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

Méthodes protégées

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

Private Methods

Méthode 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 méthode

public Generate ( Rule rule ) : void
rule Rule
Résultat void

GenerateCodeVisitor() public méthode

public GenerateCodeVisitor ( LLParserGenerator llpg ) : System
llpg LLParserGenerator
Résultat System

GeneratePredictionTreeCode() protected méthode

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

GetPredictionSubtreeCode() protected méthode

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

Visit() public méthode

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
Résultat void

Visit() public méthode

public Visit ( AndPred andp ) : void
andp AndPred
Résultat void

Visit() public méthode

public Visit ( Gate pred ) : void
pred Gate
Résultat void

Visit() public méthode

public Visit ( Pred pred ) : void
pred Pred
Résultat void

Visit() public méthode

public Visit ( RuleRef rref ) : void
rref RuleRef
Résultat void

Visit() public méthode

public Visit ( Seq pred ) : void
pred Seq
Résultat void

Visit() public méthode

public Visit ( TerminalPred term ) : void
term TerminalPred
Résultat void

VisitWithNewTarget() public méthode

public VisitWithNewTarget ( Pred toBeVisited, WList target ) : void
toBeVisited Pred
target WList
Résultat void

Property Details

F public_oe property

public LNodeFactory,Loyc.Syntax F
Résultat Loyc.Syntax.LNodeFactory

LLPG public_oe property

public LLParserGenerator LLPG
Résultat LLParserGenerator