diff --git a/unoptimized_lr/simple_lr_automaton.py b/unoptimized_lr/simple_lr_automaton.py index 0dd3286d1dd74b22e63019a682fcf46546f49363..a7c1fdc1c73b70e48d6bb998d862aa855ccb8081 100644 --- a/unoptimized_lr/simple_lr_automaton.py +++ b/unoptimized_lr/simple_lr_automaton.py @@ -46,10 +46,10 @@ from functools import reduce # # # 2) Parameters based on expected use cases: -# * NStackItems: Parse stack depth. +# * NStackDepth: Parse stack depth. # * NLongestParse: The length of the longest possible parse tree # -# log_2(NStackItems) = WStackItems +# log_2(NStackDepth) = WStackDepth # log_2(NLongestParse) = WLongestParse # # In the general case, it is impossible to determine these for a given language. @@ -133,7 +133,7 @@ from functools import reduce # Parse item stack: # # (stack operation type, index for multipop, state number to push) -# 3 bits WStackItems WStates +# 3 bits WStackDepth WStates # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # / \ # /----------------------\ /---------------------\ @@ -146,10 +146,13 @@ from functools import reduce # # # Parse index stack. Note that this is only needed if we're outputting a -# serialized parse tree (regardless if to memory or to a stream): +# serialized parse tree (regardless if to memory or to a stream). +# +# The serialization indices can be as big as WLongestParse, and we're just storing +# indices here, not the items. # # (stack operation type, index for multipop, serialization index to push) -# 3 bits WStackItems WLongestParse +# 3 bits WStackDepth WLongestParse # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> # / \ # /----------------------\ /---------------------\