Documentation
¶
Index ¶
- type CodeGenRes
- type Resrap
- type ResrapMT
- func (r *ResrapMT) GenerateRandom(id, name, starting_node string, tokens int)
- func (r *ResrapMT) GenerateWithSeeded(id, name, starting_node string, seed uint64, tokens int)
- func (r *ResrapMT) GetCodeChannel() chan CodeGenRes
- func (r *ResrapMT) ParseGrammar(name, grammar string) error
- func (r *ResrapMT) ParseGrammarFile(name, location string) error
- func (r *ResrapMT) ShutDownResrap()
- func (r *ResrapMT) StartResrap()
- type ScanError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeGenRes ¶
CodeGenRes contains the process id along with the code generated returned from ResrapMT
type Resrap ¶
type Resrap struct {
// contains filtered or unexported fields
}
Resrap is the main accesspoint for singlethreaded uses Pretty Much Collection of graphs which can be generated using parsing grammar
func NewResrap ¶
func NewResrap() *Resrap
NewResrap creates and returns a new Resrap instance. The returned instance starts with no loaded grammars.
func (*Resrap) GenerateRandom ¶
GenerateRandom generates content from the grammar identified by 'name'. starting_node: the starting heading in the grammar for generation. Returns a string containing the generated content. The generation is non-deterministic (random).
func (*Resrap) GenerateWithSeeded ¶
GenerateWithSeeded generates content from the grammar identified by 'name'. starting_node: the starting symbol in the grammar for generation. seed: a numeric seed to make generation deterministic. Returns a string containing the generated content.
func (*Resrap) ParseGrammar ¶
ParseGrammar parses a grammar string and stores it under the given name. name: a unique identifier for this grammar (e.g., "C"), should be in ABNF format(Check osdc/resrap for more info on that). Returns error generated while parsing
func (*Resrap) ParseGrammarFile ¶
ParseGrammarFile parses a grammar from a file and stores it under the given name. name: a unique identifier for this grammar (e.g., "C"), should be in ABNF format(Check osdc/resrap for more info on that). location: path to the grammar file. Returns error generated while parsing
type ResrapMT ¶
type ResrapMT struct {
// contains filtered or unexported fields
}
ResrapMT is the multithreaded version of ResrapMT
func NewResrapMT ¶
NewResrapMT creates and returns a new Resrap MultiThreaded instance. The returned instance starts with no loaded grammars.
func (*ResrapMT) GenerateRandom ¶
GenerateRandom schedules a job to generate content from the grammar identified by 'name'. starting_node: the starting symbol in the grammar for generation. id: a user-defined process ID that will be associated with the generated content. tokens: number of tokens to generate. The generation is non-deterministic (random). The generated content will be sent asynchronously to the CodeChannel. Users must provide a unique process ID and retrieve the result via the get channel function.
func (*ResrapMT) GenerateWithSeeded ¶
GenerateWithSeeded schedules a job to generate content from the grammar identified by 'name'. starting_node: the starting symbol in the grammar for generation. seed: a numeric seed to make generation deterministic. id: a user-defined process ID that will be associated with the generated content. tokens: number of tokens to generate. The generated content will be sent asynchronously to the CodeChannel. Users must provide a unique process ID and retrieve the result via the get channel function.
func (*ResrapMT) GetCodeChannel ¶
func (r *ResrapMT) GetCodeChannel() chan CodeGenRes
GetCodeChannel is the main endpoint for the user to access the processed tokens
func (*ResrapMT) ParseGrammar ¶
ParseGrammar parses a grammar string and stores it under the given name. name: a unique identifier for this grammar (e.g., "C"). grammar: the grammar definition as a string.
func (*ResrapMT) ParseGrammarFile ¶
ParseGrammarFile parses a grammar from a file and stores it under the given name. name: a unique identifier for this grammar (e.g., "C"). location: path to the grammar file.
func (*ResrapMT) ShutDownResrap ¶
func (r *ResrapMT) ShutDownResrap()
ShutDownResrap gracefully ends the server goroutines running
func (*ResrapMT) StartResrap ¶
func (r *ResrapMT) StartResrap()
StartResrap boots up goroutines as your specified threadpool