Simple precedence parser: Difference between revisions

Content deleted Content added
WOSlinkerBot (talk | contribs)
m remove un-needed options from tables
Woden (talk | contribs)
No edit summary
Line 9:
* 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>&esdot; or <Math>\lessdot</math>&ltdot;
*** '''Shift''':
*** Push(Stack, relationship)
*** Push(Stack, NextToken(Input))
*** RemoveNextToken(Input)
** if the relationship is <Math>\gtrdot</math>&gtdot;
*** '''Reduce''':
*** SearchProductionToReduce(Stack)
Line 23:
 
SearchProductionToReduce (Stack)
* search the '''Pivot''' in the stack the nearest <Math>\lessdot</math>&ltdot; from the top
* search in the productions of the grammar which one have the same right side than the '''Pivot'''
 
Line 42:
 
{| class="wikitable"
! ||E|| E' || T || T' || F || + ||*||(||)||num || $
|-
! E
| || || || || ||<math>\dot =</math>&esdot;|| || ||<math>\gtrdot</math>&gtdot; || ||<math>\gtrdot</math>&gtdot;
|-
! E'
| || || || || || || || ||<math>\dot =</math>&esdot;|| ||
|-
! T
| || || || || ||<math>\gtrdot</math>&gtdot;||<math>\dot =</math>&esdot;|| ||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;
|-
! T'
| || || || || ||<math>\gtrdot</math>&gtdot;|| || ||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;
|-
! F
| || || || || ||<math>\gtrdot</math>&gtdot;||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;
|-
! +
| || ||&ltdot;||&esdot;||&ltdot;|| || ||&ltdot;|| ||&ltdot; ||
| || ||<math>\lessdot</math>||<math>\dot =</math>||<math>\lessdot</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|-
! *
| || || || ||<math>\dot =</math>&esdot;|| || ||<math>\lessdot</math>&ltdot;|| ||<math>\lessdot</math>&ltdot; ||
|-
! (
|&ltdot;||&esdot;||&ltdot;||&ltdot;||&ltdot;|| || ||&ltdot;|| ||&ltdot; ||
|<math>\lessdot</math>||<math>\dot =</math>||<math>\lessdot</math>||<math>\lessdot</math>||<math>\lessdot</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|-
! )
| || || || || ||<math>\gtrdot</math>&gtdot;||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;
|-
! num
| || || || || ||<math>\gtrdot</math>&gtdot;||<math>\gtrdot</math>&gtdot;||||<math>\gtrdot</math>&gtdot;|| ||<math>\gtrdot</math>&gtdot;
|-
! $
|&ltdot;|| ||&ltdot;||&ltdot;||&ltdot;|| || ||&ltdot;|| ||&ltdot; ||
|<math>\lessdot</math>|| ||<math>\lessdot</math>||<math>\lessdot</math>||<math>\lessdot</math>|| || ||<math>\lessdot</math>|| ||<math>\lessdot</math> ||
|}