Documentation ¶
Index ¶
- Constants
- Variables
- func Acc()
- func NewStack() *stack
- type Accept
- type Action
- type ActionRow
- type ActionRowU
- type ActionTab
- type ActionTabU
- type Actions
- type Attrib
- type CanRecover
- type GotoRow
- type GotoRowU
- type GotoTab
- type GotoTabU
- type NT
- type Parser
- type ParserUTab
- type ProdTab
- type ProdTabEntry
- type ProdTabU
- type ProdTabUEntry
- type Reduce
- type Scanner
- type Shift
- type State
Constants ¶
View Source
const ( NUM_STATES = 120 NUM_TOKENS = 22 )
View Source
const ( NT_Grammar = 0 NT_LexicalPart = 1 NT_LexProductions = 2 NT_LexProduction = 3 NT_LexPattern = 4 NT_LexAlt = 5 NT_LexTerm = 6 NT_SyntaxPart = 7 NT_SyntaxProdList = 8 NT_SyntaxProduction = 9 NT_Alternatives = 10 NT_SyntaxBody = 11 NT_Symbols = 12 NT_Symbol = 13 NT_FileHeader = 14 )
View Source
const INITIAL_STACK_SIZE = 100
View Source
const (
NUM_NT = 15
)
NUM_NT is the set of non-terminal symbols of the target grammar.
View Source
const NUM_PRODS = 40
Variables ¶
View Source
var ProductionsTable = ProdTab{ ProdTabEntry{ "S! : Grammar ;", "S!", 1, func(X []Attrib) (Attrib, error) { return X[0], nil }, }, ProdTabEntry{ "Grammar : LexicalPart SyntaxPart << ast.NewGrammar(X[0], X[1]) >> ;", "Grammar", 2, func(X []Attrib) (Attrib, error) { return ast.NewGrammar(X[0], X[1]) }, }, ProdTabEntry{ "Grammar : LexicalPart << ast.NewGrammar(X[0], nil) >> ;", "Grammar", 1, func(X []Attrib) (Attrib, error) { return ast.NewGrammar(X[0], nil) }, }, ProdTabEntry{ "Grammar : SyntaxPart << ast.NewGrammar(nil, X[0]) >> ;", "Grammar", 1, func(X []Attrib) (Attrib, error) { return ast.NewGrammar(nil, X[0]) }, }, ProdTabEntry{ "LexicalPart : LexProductions << ast.NewLexPart(nil, nil, X[0]) >> ;", "LexicalPart", 1, func(X []Attrib) (Attrib, error) { return ast.NewLexPart(nil, nil, X[0]) }, }, ProdTabEntry{ "LexProductions : LexProduction << ast.NewLexProductions(X[0]) >> ;", "LexProductions", 1, func(X []Attrib) (Attrib, error) { return ast.NewLexProductions(X[0]) }, }, ProdTabEntry{ "LexProductions : LexProductions LexProduction << ast.AppendLexProduction(X[0], X[1]) >> ;", "LexProductions", 2, func(X []Attrib) (Attrib, error) { return ast.AppendLexProduction(X[0], X[1]) }, }, ProdTabEntry{ "LexProduction : tokId : LexPattern ; << ast.NewLexTokDef(X[0], X[2]) >> ;", "LexProduction", 4, func(X []Attrib) (Attrib, error) { return ast.NewLexTokDef(X[0], X[2]) }, }, ProdTabEntry{ "LexProduction : regDefId : LexPattern ; << ast.NewLexRegDef(X[0], X[2]) >> ;", "LexProduction", 4, func(X []Attrib) (Attrib, error) { return ast.NewLexRegDef(X[0], X[2]) }, }, ProdTabEntry{ "LexProduction : ignoredTokId : LexPattern ; << ast.NewLexIgnoredTokDef(X[0], X[2]) >> ;", "LexProduction", 4, func(X []Attrib) (Attrib, error) { return ast.NewLexIgnoredTokDef(X[0], X[2]) }, }, ProdTabEntry{ "LexPattern : LexAlt << ast.NewLexPattern(X[0]) >> ;", "LexPattern", 1, func(X []Attrib) (Attrib, error) { return ast.NewLexPattern(X[0]) }, }, ProdTabEntry{ "LexPattern : LexPattern | LexAlt << ast.AppendLexAlt(X[0], X[2]) >> ;", "LexPattern", 3, func(X []Attrib) (Attrib, error) { return ast.AppendLexAlt(X[0], X[2]) }, }, ProdTabEntry{ "LexAlt : LexTerm << ast.NewLexAlt(X[0]) >> ;", "LexAlt", 1, func(X []Attrib) (Attrib, error) { return ast.NewLexAlt(X[0]) }, }, ProdTabEntry{ "LexAlt : LexAlt LexTerm << ast.AppendLexTerm(X[0], X[1]) >> ;", "LexAlt", 2, func(X []Attrib) (Attrib, error) { return ast.AppendLexTerm(X[0], X[1]) }, }, ProdTabEntry{ "LexTerm : . << ast.LexDOT, nil >> ;", "LexTerm", 1, func(X []Attrib) (Attrib, error) { return ast.LexDOT, nil }, }, ProdTabEntry{ "LexTerm : char_lit << ast.NewLexCharLit(X[0]) >> ;", "LexTerm", 1, func(X []Attrib) (Attrib, error) { return ast.NewLexCharLit(X[0]) }, }, ProdTabEntry{ "LexTerm : char_lit - char_lit << ast.NewLexCharRange(X[0], X[2]) >> ;", "LexTerm", 3, func(X []Attrib) (Attrib, error) { return ast.NewLexCharRange(X[0], X[2]) }, }, ProdTabEntry{ "LexTerm : regDefId << ast.NewLexRegDefId(X[0]) >> ;", "LexTerm", 1, func(X []Attrib) (Attrib, error) { return ast.NewLexRegDefId(X[0]) }, }, ProdTabEntry{ "LexTerm : [ LexPattern ] << ast.NewLexOptPattern(X[1]) >> ;", "LexTerm", 3, func(X []Attrib) (Attrib, error) { return ast.NewLexOptPattern(X[1]) }, }, ProdTabEntry{ "LexTerm : { LexPattern } << ast.NewLexRepPattern(X[1]) >> ;", "LexTerm", 3, func(X []Attrib) (Attrib, error) { return ast.NewLexRepPattern(X[1]) }, }, ProdTabEntry{ "LexTerm : ( LexPattern ) << ast.NewLexGroupPattern(X[1]) >> ;", "LexTerm", 3, func(X []Attrib) (Attrib, error) { return ast.NewLexGroupPattern(X[1]) }, }, ProdTabEntry{ "SyntaxPart : FileHeader SyntaxProdList << ast.NewSyntaxPart(X[0], X[1]) >> ;", "SyntaxPart", 2, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxPart(X[0], X[1]) }, }, ProdTabEntry{ "SyntaxPart : SyntaxProdList << ast.NewSyntaxPart(nil, X[0]) >> ;", "SyntaxPart", 1, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxPart(nil, X[0]) }, }, ProdTabEntry{ "SyntaxProdList : SyntaxProduction << ast.NewSyntaxProdList(X[0]) >> ;", "SyntaxProdList", 1, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxProdList(X[0]) }, }, ProdTabEntry{ "SyntaxProdList : SyntaxProdList SyntaxProduction << ast.AddSyntaxProds(X[0], X[1]) >> ;", "SyntaxProdList", 2, func(X []Attrib) (Attrib, error) { return ast.AddSyntaxProds(X[0], X[1]) }, }, ProdTabEntry{ "SyntaxProduction : prodId : Alternatives ; << ast.NewSyntaxProd(X[0], X[2]) >> ;", "SyntaxProduction", 4, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxProd(X[0], X[2]) }, }, ProdTabEntry{ "Alternatives : SyntaxBody << ast.NewSyntaxAlts(X[0]) >> ;", "Alternatives", 1, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxAlts(X[0]) }, }, ProdTabEntry{ "Alternatives : Alternatives | SyntaxBody << ast.AddSyntaxAlt(X[0], X[2]) >> ;", "Alternatives", 3, func(X []Attrib) (Attrib, error) { return ast.AddSyntaxAlt(X[0], X[2]) }, }, ProdTabEntry{ "SyntaxBody : Symbols << ast.NewSyntaxBody(X[0], nil) >> ;", "SyntaxBody", 1, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxBody(X[0], nil) }, }, ProdTabEntry{ "SyntaxBody : Symbols g_sdt_lit << ast.NewSyntaxBody(X[0], X[1]) >> ;", "SyntaxBody", 2, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxBody(X[0], X[1]) }, }, ProdTabEntry{ "SyntaxBody : error << ast.NewErrorBody(nil, nil) >> ;", "SyntaxBody", 1, func(X []Attrib) (Attrib, error) { return ast.NewErrorBody(nil, nil) }, }, ProdTabEntry{ "SyntaxBody : error Symbols << ast.NewErrorBody(X[1], nil) >> ;", "SyntaxBody", 2, func(X []Attrib) (Attrib, error) { return ast.NewErrorBody(X[1], nil) }, }, ProdTabEntry{ "SyntaxBody : error Symbols g_sdt_lit << ast.NewErrorBody(X[1], X[2]) >> ;", "SyntaxBody", 3, func(X []Attrib) (Attrib, error) { return ast.NewErrorBody(X[1], X[2]) }, }, ProdTabEntry{ "SyntaxBody : empty << ast.NewEmptyBody() >> ;", "SyntaxBody", 1, func(X []Attrib) (Attrib, error) { return ast.NewEmptyBody() }, }, ProdTabEntry{ "Symbols : Symbol << ast.NewSyntaxSymbols(X[0]) >> ;", "Symbols", 1, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxSymbols(X[0]) }, }, ProdTabEntry{ "Symbols : Symbols Symbol << ast.AddSyntaxSymbol(X[0], X[1]) >> ;", "Symbols", 2, func(X []Attrib) (Attrib, error) { return ast.AddSyntaxSymbol(X[0], X[1]) }, }, ProdTabEntry{ "Symbol : prodId << ast.NewSyntaxProdId(X[0]) >> ;", "Symbol", 1, func(X []Attrib) (Attrib, error) { return ast.NewSyntaxProdId(X[0]) }, }, ProdTabEntry{ "Symbol : tokId << ast.NewTokId(X[0]) >> ;", "Symbol", 1, func(X []Attrib) (Attrib, error) { return ast.NewTokId(X[0]) }, }, ProdTabEntry{ "Symbol : string_lit << ast.NewStringLit(X[0]) >> ;", "Symbol", 1, func(X []Attrib) (Attrib, error) { return ast.NewStringLit(X[0]) }, }, ProdTabEntry{ "FileHeader : g_sdt_lit << ast.NewFileHeader(X[0]) >> ;", "FileHeader", 1, func(X []Attrib) (Attrib, error) { return ast.NewFileHeader(X[0]) }, }, }
Functions ¶
Types ¶
type ActionRow ¶
type ActionRow struct { Actions Actions // contains filtered or unexported fields }
type ActionRowU ¶
type ActionRowU [NUM_TOKENS]Action
type ActionTabU ¶
type ActionTabU [NUM_STATES]ActionRowU
type CanRecover ¶
type CanRecover [NUM_STATES]bool
type GotoTabU ¶
type GotoTabU [NUM_STATES]GotoRowU
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
type ParserUTab ¶
type ParserUTab struct {
// contains filtered or unexported fields
}
func NewParserUTab ¶
func NewParserUTab(tm *token.TokenMap) *ParserUTab
func (*ParserUTab) Parse ¶
func (this *ParserUTab) Parse(scanner Scanner) (res interface{}, err error)
func (*ParserUTab) Reset ¶
func (P *ParserUTab) Reset()
type ProdTab ¶
type ProdTab []ProdTabEntry
type ProdTabEntry ¶
type ProdTabU ¶
type ProdTabU [NUM_PRODS]*ProdTabUEntry
type ProdTabUEntry ¶
Click to show internal directories.
Click to hide internal directories.