Exercícios - Ambiguidade

Description

Exercícios sobre Ambiguidade em Gramáticas Livres de Contexto.
Oscar Lima Neto
Quiz by Oscar Lima Neto, updated more than 1 year ago
Oscar Lima Neto
Created by Oscar Lima Neto over 8 years ago
198
0

Resource summary

Question 1

Question
Verifique se a afirmação abaixo é verdadeira ou falsa. A gramática G = ({S, X, Y, Z}, {0, 1}, S, P), onde P = { S → 0X X → 10Z | 1Y Y → 0Z Z → 1|0 } NÃO é ambígua.
Answer
  • True
  • False

Question 2

Question
Verifique se a afirmação abaixo é verdadeira ou falsa. A gramática G = ({S}, {a, b}, S, P), onde P = { S -> SS S -> a S -> b} é ambígua.
Answer
  • True
  • False

Question 3

Question
Considere a gramática G = ({S}, {a, b, c, +, *, ( , ) }, S, P), onde P = { S→ SS | S+S | S* | (S) | a | b | c }. Ela é ambígua devido ao fato de suas derivações serem :
Answer
  • S => SS => SSS => cSS => caS => cab S => SS => SSS => SSb => Sab => cab
  • S => SS => SSS => (S)SS => (a)SS => (a)bS => (a)bb S => SS => (S)S => (a)S => (a)SS => (a)bS => (a)bb
  • S => SS => SSS => SSb => (S)bb => (a)bb S => SS => (S)S => (S)SS => (a)SS => (a)bS => (a)bb

Question 4

Question
A afirmação abaixo está correta? A gramática G = ({S, X}, {a, b} , {S → X | Sa, X → a | b}, S) NÃO é ambígua.
Answer
  • True
  • False

Question 5

Question
Considere a gramática G = ({S}, {a, b}, {S -> aSbS | bSaS | a | b}, S). Está é ambígua pelo fato de suas derivações serem:
Answer
  • S => bSaS => bSaa => baaa S => bSaS => baaS => baaa
  • S => bSaS => bSSaS => baSaS => baaaS => baaab S=> bSaS => bSaSS => bSaSb => bSaab => baaab
  • S => aSbS => aSba => abSaSba => abSabba => abbabba S => aSbS => aSbaSbS => aSbaSba => aSbabba => abbabba
Show full summary Hide full summary

Similar

Semântica - Significação das palavras
Antonio Rodrigues
Minimização de AF
Igor Baliza
Gramaticas EBNF,BNF e Ambiguas
Jonathas Cavalcante
Compreensão e interpretação detextos
Ale Brands
Equivalência ACPND-GLC
Darlan Santana F
Vamos pensar como Leonardo Da Vinci?
Karina Costa2013
Semântica
Laene Abreu
Semântica de nomes
Lais Oliveira
Semântica - Significação das palavras
Guilherme Rodrigues
Ambiguidade e Paráfrase.
Kelly Cristine Danderfer
AMBIGUIDADE
Evelyn Barbosa