LL(1) parsing

Created
Created
2022 Oct 7 4:10
Creator
Creator
Seonglae ChoSeonglae Cho
Editor
Edited
Edited
2022 Oct 14 18:3
Refs
Refs
Based on a call stack rather than function calls
Like running a
Push Down Automaton
(PDA)
  • scan from left to right, and perform leftmost derivation
  • look ahead at most one input symbol
 
Parsing Table
LL(1) Grammar
 
  • L - from Left to right
  • L - Leftmost
  • (1) - lookahead
 
 
  • Begin by pushing the start nonterminal to the stack
  • Perform actions based on stack and next token
  • Accept if both stack and input become empty
 
Two Actions:
  1. If stack top is a nonterminal A and A à ⍺, replace A with ⍺ (generate)
  1. If stack top is a terminal (token), match it with input token
      • If matched, pop stack and advance input
      • Otherwise, throw an error
 
 
 
 
 

Recommendations