Published February 3, 2021 | Version v1
Journal article Open

LEFT TO RIGHT-RIGHT MOST PARSING ALGORITHM WITH LOOKAHEAD

Creators

  • 1. SemanticsWise Labs, Canada

Description

Left to Right-Right Most (LR) parsing algorithm is a widely used algorithm of syntax analysis. It parses the input contingent to the information in its parsing table whereas the parsing tables are extracted from the grammar. The parsing table specifies the actions to be taken during parsing. It requires that the parsing table should have no action conflicts for the same input symbol. This requirement imposes a condition on the class of grammars over which the LR algorithms work. However, there are grammars for which the parsing tables hold action conflicts. In such cases, the algorithm needs a capability of scanning (lookingahead) next input symbols ahead of the current input symbol. In this paper, a ‘Left to Right’-‘Right Most’ parsing algorithm with lookahead capability is introduced. The “look-ahead” capability in the LR parsing algorithm is the major contribution of this paper. The practicality of the proposed algorithm is substantiated by the parser implementation of the Context Free Grammar (CFG) of an already proposed programming language “State Controlled Object Oriented Programming” (SCOOP). SCOOP’s Context Free Grammar has 125 productions and 192 item sets. This algorithm parses SCOOP while the grammar requires to ‘look ahead’ the input symbols due to action conflicts in its parsing table. Proposed LR parsing algorithm with lookahead capability can be viewed as an optimization of ‘Simple Left to Right’-‘Right Most’ (SLR) parsing algorithm.

Files

11121ijpla01.pdf

Files (533.7 kB)

Name Size Download all
md5:25ece1dc62da8b43e5960cbf7b7703ed
533.7 kB Preview Download