Content deleted Content added
→Example: use special characters |
Added explanations for the symbols of the grammar, what the grammar parses at a high level, and fixed an error in the table. The algorithm aplication had an error too. |
||
Line 28:
==Example==
Given following language, which can parse arithmetic expressions with the multiplication and addition operations:
<pre>
E --> E + T' | T'
Line 37:
</pre>
'''num''' is a terminal, and the [[lexer (computer science)|lexer]] parse any integer as '''num'''; '''E''' represents an arithmetic expression, '''T''' is a term and '''F''' is a factor.
and the Parsing table:
Line 45:
|-
! E
| || || || || ||≐|| || ||⋗ || ||
|-
! E'
Line 60:
|-
! +
| || ||
|-
! *
Line 92:
$ ⋖ T ≐ * ⋖ ( ⋖ E ≐ + < 3 ⋗ )$ REDUCE 3× (F -> num) (T -> F) (T' -> T)
$ ⋖ T ≐ * ⋖ ( ⋖ E ≐ + ≐ T ⋗ )$ REDUCE 2× (E -> E + T) (E' -> E)
$ ⋖ T ≐ * ⋖ (
$ ⋖ T ≐ * ⋖ (
$ ⋖ T ≐ * ≐ F ⋗ $ REDUCE (T -> T * F)
$ ⋖ T ⋗ $ REDUCE 2× (T' -> T) (E -> T')
|