Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{
Lookahead: 3,
}
DefaultOptions is the Options, to be optionally modified by Option functions.
Functions ¶
This section is empty.
Types ¶
type Option ¶
Option modifies an Options.
func BruteForce ¶
func BruteForce() Option
BruteForce returns an Option that sets the Lookahead to the length of the longest [str.String] in the slice.Slice. Thus, for each stage in the process, every [str.String] index that could yield a Pivot is considered. This scales really badly for large sets.
type Options ¶
type Options struct {
// Lookahead defines the number of extra indices to consider.
// By default, when the compiler looks for a Pivot, it considers Symbols at
// the position immediately after the longest common prefix of all the
// [String] values in the [Slice]. If Lookahead=n && n>0, the compiler will
// also look for a Pivot in the next n subsequent positions, and from the
// resulting Pivots, choose the one with the lowest Balance value (meaning,
// the pivot that comes closest to bisecting the Slice). This gives the
// compiler more opportunities to create a more balanced search tree for the
// [program.Program] to carry out.
//
// A non-zero Lookahead means the final [program.Program] can backtrack by a
// maximum number of Symbols equal to the Lookahead value.
Lookahead int
}
Options configures the process of building of a [program.Program].
Click to show internal directories.
Click to hide internal directories.