Ambiguity can refer to two related concepts: 'ambiguous calls' and 'ambiguous grammars'.
Questions tagged [ambiguity]
400 questions
0
votes
1 answer
Python Output Ambiguity
So I have written the following code to generate combinations (n choose k):
#!/usr/bin/env python3
combinations = []
used = []
def init(num):
for i in range(0, num+1):
combinations.append(0)
used.append(0)
def…
user3599681
0
votes
2 answers
Eliminating ambiguity by left factoring
Can you eliminate ambiguity by left factoring?
For example, the dangling else.
Or is left factoring only eliminating left recursion?
Thanks.

James Edwins
- 73
- 1
- 5
0
votes
1 answer
Solve ambiguity in my grammar with LALR parser
I'm using whittle to parse a grammar, but I'm running into the classical LALR ambiguity problem. My grammar looks like this (simplified):
::= '{' '}' # string enclosed in braces
::= '[' ']' #…

tobiasvl
- 570
- 4
- 20
0
votes
0 answers
Resolving nondeterminism from an args list in a simple PLY interpreter
I'm having trouble resolving something that I feel like should be trivial. I modified PLY's calc example to include some function calls, and an argument list that can accept one or more expressions (an expression is a name, number, or literal). The…

risto
- 1,274
- 9
- 11
0
votes
1 answer
Is this an ambiguous grammar or not?
I'm trying to find out if the following grammar is ambiguous or unambiguous:
stmt -> IF expr THEN stmt | matchedStmt
matchedStmt -> IF expr THEN matchedStmt ELSE stmt | other
It implements the if-then-else struct.
expr and other are considered to…

Sofia
- 11
- 2
0
votes
1 answer
How come this class in composition is shared?
I know that in UML, composition means that one class basically includes other with lifetime dependency,i.e. when this class is destroyed, the composing class is destroyed as well. Unlike the aggregation, the class is not shared.
But then I saw - at…

John V
- 4,855
- 15
- 39
- 63
0
votes
1 answer
Checking Ambiguious Grammar
Is the following grammar ambiguous?
S -> AS | ε
A -> A1 | 0A1 | 01
It's seemed to me that they are ambiguious as
A -> A1->0A11->00111
Again,
A-> 0A1 ->0A11->00111
Am I right?

Light
- 199
- 1
- 3
- 9
0
votes
0 answers
Global Scope Variable and Ambiguation in "Star Control Timewarp"
I'm compiling "Star Control Timewarp" from http://timewarp.sourceforge.net
The problem is the game requires a variable to be declared at the global scope that is already claimed by a file that appears to be a standard linux math library.
I've…

user2852086
- 11
- 3
0
votes
2 answers
C++ Matrix template, ambiguity between matrix-matrix and matrix-number multiplication
I’m writing a matrix template class. All went well until I was overloading the multiplication operator. My class look like this:
template class Matrix
{
private:
// ...
TNum* Data;
public:
const TMatIdx NRows; // Type…

MetroWind
- 541
- 4
- 16
0
votes
2 answers
Pass arbitrary actions to the same method
Why is the following call ambiguous:
public class Foo
{
public void Bar (Action simple);
public void Bar (Action complex);
}
...
public class Test
{
public static void MyComplex (string a, string b) { ...…

D.R.
- 20,268
- 21
- 102
- 205
0
votes
1 answer
How should I parse bundled command line option with ambiguities?
I'm creating a command line parser and want to support option bundling. However, I'm not sure how to handle ambiguities and conflicts that can arise. Consider the three following cases:
1.
-I accepts a string
"-Iinclude" -> Would be parsed as "-I…

NordCoder
- 403
- 1
- 7
- 21
0
votes
2 answers
Ambiguity in interfaces
interface A
{
int a = 10;
}
interface B
{
int a = 10;
}
class Access implements A, B
{
}
class Demo
{
public static void main(String args[])
{
Access ac = new Access();
System.out.println(ac.a); // line #1
}
}
Line #1 causes…

Neha Gupta
- 847
- 1
- 8
- 15
0
votes
1 answer
Ambiguity error?
So I'm rather a newbie when it comes to programming especially in c# i have an error i need help with?
So I'm trying to create a rpg system i started out before all else with the battle system which i just barely began my code which is store in…

user2350585
- 17
- 6
0
votes
0 answers
CakePHP Routing & HTML Helper Link Ambiguity
I have a site that uses CakePHP 2.x. There's a backend interface where actions use the standard Cake layouts and views, but several of the actions are also exposed to front end users as "dialogs" (same functionality, just a layout that can be put…

theraccoonbear
- 4,283
- 3
- 33
- 41
0
votes
1 answer
Printing a binary tree using InOrder traversal without ambiguity
I am trying to print out a binary tree using in-order traversal (in java), but without any ambiguity.
I created the tree from a post-order notation input.
For example, input = 2 3 4 * - 5 +
I then create the tree, and want to print it out using…

alexcohenza
- 31
- 4