Documentation ¶
Index ¶
- type Item
- type ItemSet
- func (this *ItemSet) Action(symbol string) (act1 action.Action, conflicts []action.Action)
- func (this *ItemSet) AddItem(items ...*Item)
- func (this *ItemSet) AddTransition(symbol string, nextSet int)
- func (this *ItemSet) CanRecover() bool
- func (this *ItemSet) Closure() (c *ItemSet)
- func (this *ItemSet) Contain(item *Item) bool
- func (this *ItemSet) ContainString(item string) bool
- func (this *ItemSet) Equal(that *ItemSet) bool
- func (I *ItemSet) Goto(X string) *ItemSet
- func (this *ItemSet) NextSetIndex(symbol string) int
- func (this *ItemSet) Size() int
- func (this *ItemSet) String() string
- type ItemSets
- type RowConflicts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Item ¶
type Item struct { ProdIdx int // index in list of productions in Grammar.Prod Prod *ast.SyntaxProd // The syntax production of this item Id string Body []string Pos int // position of • in the item ExpectedSymbol string // the next exptect symbol in the item, if this isn't a reduce item. FollowingSymbol string // The next expected symbol after the item has been recognised Len int // the number of symbols making up the body // contains filtered or unexported fields }
An LR1 Item.
type ItemSet ¶
type ItemSet struct { SetNo int Items []*Item // string: symbol, int: nextState. Transitions map[string]int Symbols *symbols.Symbols Prods ast.SyntaxProdList FS *first.FirstSets // contains filtered or unexported fields }
func InitialItemSet ¶
Returns the initial Item of a Grammar.
func NewItemSet ¶
NewItemSet returns a newly cosntructed set of items.
func (*ItemSet) AddTransition ¶
func (*ItemSet) CanRecover ¶
func (*ItemSet) Closure ¶
TODO: optimise loop
Dragon book, 2nd ed, section 4.7.2, p261
Closure(I) repeat for each item [A->x•By, a] in I for each production B -> z in G' for each terminal b in FIRST(ya) add [B -> •z, b] to I until no more items are added to I
func (*ItemSet) ContainString ¶
func (*ItemSet) NextSetIndex ¶
type ItemSets ¶
type ItemSets struct {
// contains filtered or unexported fields
}
A list of a list of Items.
func GetItemSets ¶
TODO: optimise loop g is a BNF grammar. Items returns the sets of Items of the grammar g.
type RowConflicts ¶
key: symbol; value: list of actions.
Click to show internal directories.
Click to hide internal directories.