Skip to Content
An Introduction to Formal Languages and Automata, 7th Edition
book

An Introduction to Formal Languages and Automata, 7th Edition

by Peter Linz, Susan H. Rodger
February 2022
Beginner to intermediate content levelBeginner to intermediate
572 pages
13h
English
Jones & Bartlett Learning
Content preview from An Introduction to Formal Languages and Automata, 7th Edition

16.2 LL(1) PARSE TABLE

To simplify the parsing process, information from the npda combined with lookaheads can be stored in a table called the LL(k) Parse Table. For now we focus on k = 1, and show how to build an LL(1) Parse Table.

LL(1) Parse Table

For a context-free grammar G = (V, T, S, P), the rows of the table are labeled with AV and the columns of the table are labeled with aT∪{$}, the symbols that could be a lookahead.

To construct the LL(1) Parse Table. Let AV, and w ∈ (VT)*.

  1. For each production Aw.
    1. For each a in FIRST(w), add w to LL[A, a].
    2. If λ ∈ FIRST(w), add w to LL[A, b] for each b in FOLLOW(A).
  2. Each undefined entry is error.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

An Introduction to Formal Languages and Automata, 6th Edition

An Introduction to Formal Languages and Automata, 6th Edition

Peter Linz
Introduction to Probability

Introduction to Probability

Joseph K. Blitzstein, Jessica Hwang

Publisher Resources

ISBN: 9781284231618