On the prediction of reduction goals: a deterministic approach
In LR parsing, a reduction goal is known at reduction time, but the goal can be sometimes found before that time. We recently proposed an algorithm generating pre-determinable reduction goals during LR parsing. On the other hand, the method requires a parser constructor to select a goal among a set of pre-determinable reduction goals. The non-deterministic set approach is hence inadequate to be used in an automatic parser generating system. This paper presents a deterministic approach such that a unique predicted goal is generated. The crux of the approach lies in preserving all the prediction information. We prove that all the predicted goals are orderable by the number of parsing actions required before a reduction occurs from the current parsing configuration. Based on the property, we propose the strategy choosing the nearest goal from the current parsing configuration as a way to impose determinism. This paper lastly shows the usefulness of the proposed approach in error handing applications of pre-determinable reduction goals.
reduction goals lr parsing compilers ll parsing