Understanding Grammar #2: Ambiguity, Elimination, and Boolean Expressions

In summary, the first conversation discusses a grammar that generates strings using the symbols "a" and ",". The second conversation discusses a grammar that generates boolean expressions using "or", "and", "not", "true", "false", and parentheses. The question being asked is whether this grammar is ambiguous, and if so, how to eliminate the ambiguity. Additionally, the conversation delves into the use of symbols in boolean logic and how they are commonly written. The brackets "()" typically represent grouping in programming, and the symbols "|" and "&" are not used for logical "or" and "and" in boolean logic, but rather for regular expressions. The conversation also prompts the listener to reflect on the concepts of ambiguity and terminals in grammar.
  • #1
magneeto
6
0
what langugage??

grammar #1:

S->(L)|a
L->L,S|S

what language does this grammar generate? some strings generated by this grammar r (a,a), (a,(a,a))...

grammmar #2:

bexpr->bexpr or bterm| bterm
bterm-> bterm and bfactor| bfactor
bfactor-> not bfactor| (bexpr) | true | false

is this grammar ambiguous? if so then why?
is there any way to eliminate ambiguity?
how do i show that this grammmar generates all boolean expressions? i can see it but how do i proceed to prove it?
 
Computer science news on Phys.org
  • #2
when you type L,S do you mean LS
and when you type or and and are you using the booleans | and &
(|| and &&,the hat and the v whichever notation you like )
what do teh brackets () normally represent in programming
ask your self what is an ambiguity and what are "terminals"
what do the rules bexpr and bterm attempt represent
how does one normally write boolean logic?? or concatenate sets of booleans
 
  • #3
",","()","a" are all terminals and "|" is not the logical or . it is the or for regular expressions(either expr1 or expr2)
 

Related to Understanding Grammar #2: Ambiguity, Elimination, and Boolean Expressions

1. What is ambiguity in grammar?

Ambiguity in grammar refers to a situation where a sentence or phrase can have more than one interpretation or meaning. This can happen due to unclear or multiple word meanings, sentence structure, or punctuation.

2. How can ambiguity be eliminated in writing?

Ambiguity can be eliminated in writing by using clear and specific language, avoiding vague words or phrases, and carefully considering sentence structure and punctuation. It is also important to proofread and revise your writing to ensure clarity and eliminate any potential confusion.

3. What are some common examples of ambiguous sentences?

Some common examples of ambiguous sentences include: "I saw her duck" (did she see a duck or crouch down?), "Time flies like an arrow" (does time fly quickly or in the same direction as an arrow?), and "She told him he was stupid" (did she tell him that he was stupid or that he was not?).

4. How can Boolean expressions be used in grammar?

Boolean expressions are used in grammar to represent logical relationships between words or phrases. They can help clarify the intended meaning of a sentence and eliminate ambiguity by clearly defining the relationship between different elements in a sentence.

5. What are some strategies for understanding grammar with Boolean expressions?

To better understand grammar with Boolean expressions, it is helpful to break down a sentence into smaller elements and consider the logical relationships between them. It is also useful to practice identifying and interpreting Boolean expressions in different sentences to improve your understanding and application of this concept.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
26
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
969
  • Programming and Computer Science
Replies
1
Views
1K
  • Computing and Technology
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
927
Replies
31
Views
831
  • Programming and Computer Science
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
2K
Back
Top