Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Grammar ¶
type Grammar struct { // Productions is a map from a non-terminal (LHS) to its set of production rules (RHS) Productions map[string][]ProductionRule }
Grammar represents a context-free grammar.
type ProductionRule ¶
type ProductionRule []Symbol
ProductionRule is the right-hand-side of a production
type TokenStream ¶
type TokenStream struct {
// contains filtered or unexported fields
}
TokenStream produces a string of tokens from a grammar
func MakeTokenStream ¶
func MakeTokenStream(g *Grammar, startSymbol string) TokenStream
MakeTokenStream creates a TokenStream for a Grammar and start symbol.
func (*TokenStream) Produce ¶
func (t *TokenStream) Produce(stopAfter uint) string
Produce generates a string of tokens but stops after a length limit is reached. The length of the returned string may exceed stopAfter.
Click to show internal directories.
Click to hide internal directories.