Skip to content

M-Shalabi/Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

git clone https://github.com/DevMedo/Compiler

SLR Parser In Java

SLR parser is quite efficient at finding the single correct bottom-up parse in a single left-to-right scan over the input stream, without guesswork or backtracking. The parser is mechanically generated from a formal grammar for the language.

Source: Simple LR parser From Wikipedia

1.Input.txt

(id+id)*id$

Note: You can also use (id+id)*(id+id)$

2.Rules

  1. E → E+T
  2. E → T
  3. T → T*F
  4. T → F
  5. F → (E)
  6. F → id

3.Parse Table

4.Output

5.Example