1 / 9

Análisis Sintáctico Predictivo No Recursivo

Análisis Sintáctico Predictivo No Recursivo. Sección 4.4. Modelo analizador sintáctico predictivo no recursivo. a. +. b. $. ENTRADA. Programa para análisis sintáctico predictivo. PILA. X. SALIDA. Y. Z. Tabla de análisis sintáctico M. $. M[ X ,+]. E => TE’ E’ => + TE’ | nil

Download Presentation

Análisis Sintáctico Predictivo No Recursivo

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Análisis Sintáctico Predictivo No Recursivo Sección 4.4

  2. Modelo analizador sintáctico predictivo no recursivo a + b $ ENTRADA Programa para análisis sintáctico predictivo PILA X SALIDA Y Z Tabla de análisis sintáctico M $ M[X,+]

  3. E => TE’ E’ => +TE’ | nil T => FT’ T’ => *FT’ | nil F => (E) | id Ejemplo

  4. Primero y Siguiente • Primero(α) • Conjunto de terminales • Que inician las cadenas de α • Si α =>* nil • nil también está en Primero(α)

  5. Primero y Siguiente • Siguiente(A) • Conjunto de terminales a • Que pueden aparecer a la derecha de A • S =>* αAaβ para algún α y β • Obsérvar • S =>* αABCaβ • a pertenece a Siguiente(A) si: • B =>* nil • C =>* nil

  6. Construcción de tabla M • M [X, x] X no terminal, x terminal • Para cada A => α • Para cada terminal a de Primero(α) • Añadir A => α a M[A,a] • Si nil está en Primero(α) • Añadir A => α a M[A,b] • Para cada b de Siguiente(A) • Si nil está en Primero(α) y $ en Siguiente(A) • Añadir A => α a M[A,$] • Toda entrada vacía de M es error

  7. Ejemplo • Construír M para P => i E t PP’ | a P’ => e P | nil E => b

  8. Gramáticas LL(1) • Gramática con M sin entradas múltiples • L de “left” • Se analiza la entrada de izquierda a derecha • L de “left derivative” • Se deriva por la izquierda • (1) de que solo se analiza un token anticipadamente

  9. Propiedades LL(1) • No pueden ser ambiguas • No pueden ser recursivas por la izquierda

More Related