Added caching of the RNGLR table. It is automatically regenerated whenever the grammer changes. Right now it has dropped compiling the test file from 30 seconds to less than one second.
This commit is contained in:
41
Kraken_Compiled_Grammer_file_format.txt
Normal file
41
Kraken_Compiled_Grammer_file_format.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
Kraken Compiled Grammer file format (.kgm.comp)
|
||||
|
||||
This file is generated on first run, and regenerated everytime the grammer changes.
|
||||
It contains the RNGLR table generated from the specified grammer so that it does not
|
||||
have to be remade every time Kraken is run, saving a lot of time.
|
||||
(at time of writing, non-cached: ~30 seconds, cached: <1 second)
|
||||
|
||||
|
||||
This is a binary format. The first bytes are a magic number (KRAK in asci)
|
||||
|
||||
The next bytes are an unsigned integer indicating how many characters follow.
|
||||
Next are these characters, which are the grammer file as one long string.
|
||||
|
||||
Next is the parse table length, followed by the table itself, exported with the table's export method.
|
||||
It can be imported with the import method.
|
||||
Note that within the parse table's data are parse actions, and within that, Symbols.
|
||||
|
||||
The format: (more or less)
|
||||
____________________
|
||||
|KRAK
|
||||
|length_of_grammer_text
|
||||
|GRAMMER_TEXT
|
||||
|PARSE_TABLE
|
||||
|-|length_of_symbol_index_vector
|
||||
|-|SYMBOL_INDEX_VECTOR
|
||||
|-|length_of_out_table_vector
|
||||
|-|OUT_TABLE_VECTOR
|
||||
|-|-|length_of_mid_table_vector
|
||||
|-|-|MID_TABLE_VECTOR
|
||||
|-|-|-|length_of_in_table_vector
|
||||
|-|-|-|IN_TABLE_VECTOR
|
||||
|-|-|-|-|length_of_parse_action
|
||||
|-|-|-|-|PARSE_ACTION
|
||||
|-|-|-|-|-|ActionType
|
||||
|-|-|-|-|-|ParseRule__if_exists
|
||||
|-|-|-|-|-|-|pointerIndex
|
||||
|-|-|-|-|-|-|Symbol_left_handel
|
||||
|-|-|-|-|-|-|rightside_vector_symbol
|
||||
|-|-|-|-|-|shiftState
|
||||
____________________
|
||||
|
||||
Reference in New Issue
Block a user