Skip to main content
Removed all mentioning of homework, as per the homework cleanup act. (original is close to dump of a question)
Link
Raphael
  • 73.4k
  • 31
  • 184
  • 406
Removed all mentioning of homework, as per the homework cleanup act. (original is close to dump of a question)
Source Link

I have a homework assignment:

Given following grammar:

$$ \begin{align} S \rightarrow &A1B \\ A \rightarrow & 0A \mid \varepsilon \\ B \rightarrow & 0B \mid 1B \mid \varepsilon \\ \end{align} $$

  • Show that this grammar is unambiguous.

  • Find a grammar for the same language that is ambiguous, and demonstrate it.

How can I show that this grammar is unambiguous? I need to find a grammar for the same language that is ambiguous, and demonstrate it.

I know if I was asked to prove that the language is ambigious then I should find two different parse trees for same string. But, but I don't know what to do for this question.

I have a homework assignment:

Given following grammar:

$$ \begin{align} S \rightarrow &A1B \\ A \rightarrow & 0A \mid \varepsilon \\ B \rightarrow & 0B \mid 1B \mid \varepsilon \\ \end{align} $$

  • Show that this grammar is unambiguous.

  • Find a grammar for the same language that is ambiguous, and demonstrate it.

I know if I was asked to prove that the language is ambigious then I should find two different parse trees for same string. But I don't know what to do for this question.

Given following grammar:

$$ \begin{align} S \rightarrow &A1B \\ A \rightarrow & 0A \mid \varepsilon \\ B \rightarrow & 0B \mid 1B \mid \varepsilon \\ \end{align} $$

How can I show that this grammar is unambiguous? I need to find a grammar for the same language that is ambiguous, and demonstrate it.

I know if I was asked to prove that the language is ambigious then I should find two different parse trees for same string, but I don't know what to do.

Tweeted twitter.com/#!/StackCompSci/status/282303121626124288
retag, use latex for grammar, remove hello and thanks
Source Link
A.Schulz
  • 12.3k
  • 1
  • 43
  • 64

I have a homework assignment:

Given following grammar:

$ S \rightarrow A1B \\ A \rightarrow 0A \;|\; \varepsilon \\ B \rightarrow 0B \;|\; 1B \;|\; \varepsilon \\ $$$ \begin{align} S \rightarrow &A1B \\ A \rightarrow & 0A \mid \varepsilon \\ B \rightarrow & 0B \mid 1B \mid \varepsilon \\ \end{align} $$

  • Show that this grammar is unambiguous.

  • Find a grammar for the same language that is ambiguous, and demonstrate it.

I know if I was asked to prove that the language is ambigious then I should find two different parse trees for same string. But I don't know what to do for this question.

I have a homework assignment:

Given following grammar

$ S \rightarrow A1B \\ A \rightarrow 0A \;|\; \varepsilon \\ B \rightarrow 0B \;|\; 1B \;|\; \varepsilon \\ $

  • Show that this grammar is unambiguous.

  • Find a grammar for the same language that is ambiguous, and demonstrate it.

I know if I was asked to prove that the language is ambigious then I should find two different parse trees for same string. But I don't know what to do for this question.

I have a homework assignment:

Given following grammar:

$$ \begin{align} S \rightarrow &A1B \\ A \rightarrow & 0A \mid \varepsilon \\ B \rightarrow & 0B \mid 1B \mid \varepsilon \\ \end{align} $$

  • Show that this grammar is unambiguous.

  • Find a grammar for the same language that is ambiguous, and demonstrate it.

I know if I was asked to prove that the language is ambigious then I should find two different parse trees for same string. But I don't know what to do for this question.

Loading
Source Link
quartaela
  • 133
  • 1
  • 4
Loading