Function opg::opg_generate [−][src]
pub(crate) fn opg_generate(contents: &String)
Generate Operator Precedence Table for context-free grammar contents.
Input
contents
The string read from file.
Example
// Contents of the file let contents = fs::read_to_string(filename).expect("No such file."); // Get the table opg_generate(&contents);
Principles
Generate FIRSTVT and LASTVT for the contents.
Then add S->$S$ for the starting non-terminal.
Generate OpTable
struct based on the algorithm
of find_eq()
, find_less()
, find_greater()
.
Finally, print the OpTable
.