Simple precedence parser: Difference between revisions

Content deleted Content added
wikified
m General fixes. using AWB
Line 1:
{{Unreferenced stub|auto=yes|date=December 2009}}
 
In computer science, a '''Simple precedence parser''' is a type of [[bottom-up parser]] for [[context-free grammars]] that can be used only by [[Simple precedence grammar]]s.
Line 11:
* While not (Stack equals to $S and Input equals to $) (S = Initial symbol of the grammar)
** Search in the table the relationship between Top(stack) and NextToken(Input)
** if the relationship is <Math> \dot =</math> or <Math>\lessdot</math>
*** '''Shift''':
*** Push(Stack, relationship)
*** Push(Stack, NextToken(Input))
*** RemoveNextToken(Input)
** if the relationship is <Math>\gtrdot</math>
*** '''Reduce''':
*** SearchProductionToReduce(Stack)
*** RemovePivot(Stack)
Line 46:
| ||E|| E' || T || T' || F || + ||*||(||)||num || $
|-
| E || || || || || ||<math>\dot =</math>|| || ||<math>\gtrdot</math> || ||<math>\gtrdot</math>
|-
| E'|| || || || || || || || ||<math>\dot =</math>|| ||
|-
| T || || || || || ||<math>\gtrdot</math>||<math>\dot =</math>|| ||<math>\gtrdot</math>|| ||<math>\gtrdot</math>
|-
| T'|| || || || || ||<math>\gtrdot</math>|| || ||<math>\gtrdot</math>|| ||<math>\gtrdot</math>
|-
| F || || || || || ||<math>\gtrdot</math>||<math>\gtrdot</math>|| ||<math>\gtrdot</math>|| ||<math>\gtrdot</math>
|-
| + || || ||<math>\lessdot</math>||<math>\dot =</math>||<math>\lessdot</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|-
| * || || || || ||<math>\dot =</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|-
| ( ||<math>\lessdot</math>||<math>\dot =</math>||<math>\lessdot</math>||<math>\lessdot</math>||<math>\lessdot</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|-
| ) || || || || || ||<math>\gtrdot</math>||<math>\gtrdot</math>|| ||<math>\gtrdot</math>|| ||<math>\gtrdot</math>
|-
| num|| || || || || ||<math>\gtrdot</math>||<math>\gtrdot</math>||||<math>\gtrdot</math>|| ||<math>\gtrdot</math>
|-
| $ ||<math>\lessdot</math>|| ||<math>\lessdot</math>||<math>\lessdot</math>||<math>\lessdot</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|}