Apparently, these productions (code extract below) "look good", but I am getting a shift/reduce error as follows:
[Logical = Relational] followed by GreaterThan (reduce)
[Relational = Relational GreaterThan Binary] (shift)
Any insight would be greatly appreciated.
Thanks!
logical = {simple} relational |
{exclusive_and}...
I have a Bison rule
block: LBRACE { some code } decls stmts RBRACE {more code }
;
The issue is in the "more code" section, I have
$$ = $3 ;
Basically, I want the return value of block to be stmts. When I do this, Bison says "$3 of block has no type." If I remove the code block containing some code and stick it into the latt...
The input is a string representing a list of elements.
A list is defined as an open curly { followed by 0 or more elements separated by whitespace followed by a closed curly }.
An element is either a literal or a list of elements.
A literal is a succession of non-whitespace characters. If an element contains a curly bracket, it must ...
Hello there,
I am using CocoR to generate a java-like scanner/parser:
I'm having some troubles in creating a EBNF expression to match a codeblock:
I'm assuming a code block is surrounded by two well-known tokens:
<& and &>
example:
public method(int a, int b) <&
various code
&>
If I define a nonterminal symbol
codeblock =...
I have an assignment to correct an ambiguous BNF, but I am completely lost. I know this not a true programming question, and I will gladly delete it if it is not an appropriate question for these boards. Are there any good sites where I could learn more about BNF's? The one I am dealing with seems rather simple, but I can't find any exam...
Okay, we all know what the valid left-hand-side expressions are. Kind of.*
But, looking at the definition from the ECMA-Script standard, I'm very confused:
LeftHandSideExpression :
NewExpression
CallExpression
Is that just an error in the definition, or am I getting something wrong here? I mean, doesn't that actually mean tha...
I have this grammar and need to modify it to allow parenthesis like: (-1) and -(1*5) possibly 1+(2*5) as well as unary the unary minus sign.
Does anyone have any suggestions of how to do so?
<expr> ::= <term> | <expr> <op1> <term>
<term> ::= <darg> |<term> <op2> <darg>
<darg> ::= <digit> | <darg> <digit>
<digit> ::= 0 | 1 | 2 | 3 |...
I recently finished a project in which I was generating lists of strings, and I was wondering about the best way to do this.
The string generation was context sensitive to determine if it was acceptable(it was a sequence of plays in a game, so you had to know what the last play was)
The way I did it was with a function that was passed ...
I know that it is 128 Euro and 128 apples.
I think it is 128 kilobytes, megabytes, gigabytes. Or is it 128 kilobyte, megabyte, gigabyte?
If plural is correct, I should really use 128 kBs, MBs, GBs. That looks unfamiliar.
Which is correct, plural or singular?
Thanks :)
...
Hi,
I'm trying to implement a language (or family of languages) whose grammar can be changed dynamically. I have found no examples that serve as study cases.
Can you give me some reference to any that are actually used in the real world (even from the academic world)?
Does it make sense to implement a Domain-Specific Languages with a ...
Hi all,
I am trying to use semantic predicates in ANTLR for the following grammar rule
test[n]
:({n==0}? => ~('a'))
|({n==1}? => ~('b'))
|({n==2}? => ~('c'))
;
However, ANTLR does not let me define the grammar in such a way, requiring that at least one of the alternatives be default. The exact error displ...
I have the following code written in ANTLRWorks 1.4
grammar hmm;
s : (put_a_in_b)|(put_out_a)|(drop_kick)|(drop_a)|(put_on_a);
put_a_in_b : (PUT_SYN)(ID)(IN_SYN)(ID);
put_out_a : (PUT2_SYN)(OUT_SYN)(ID) | (E1)(ID);
drop_kick : ('drop')('kick')(ID);
drop_a : (DROP_SYN)(ID);
put_on_a : (E2)(ID);
PU...
I am scoping out a custom dictation application to be built using MS SAPI 5. I would like to be able to change the grammar (topic) of dictation dynamically based on what is being recognized. For example, if my dictation application deals with car repair, then, if I detect the speaker talking about engine, I want to bring in a dictation t...
I have the following grammar in ANTLRWorks 1.4. I'm playing around with ideas for implementation of a parser in a text-adventure game creator, where the user will specify the various allowable commands for his game.
grammar test;
parse : cmd EOF;
cmd : putSyn1 gameObject inSyn1 gameObject;
putSyn1 : Put | Pla...
I have this language:
{an bm | m+n is an even number}
What's the proper grammar for this?
...
Hi,
I'm using JavaCC to build a complex parser. At one point, I would like to skip all the character I see until a desired token in my grammar... let's take for example the following
/* bla bla bla bla bla bla bla bla */ => I would like to define a kind of grammar like
<OPEN_COMMENT> SKIP ~[] until <CLOSE_COMMENT> I want it to be t...
Where can I find an official grammar for the PL/SQL programming language? I see that the Antlr project has a user-contributed grammar, but I was hoping to find a more authoritative source.
...
I wonder how is generated the grammar of the Python language and how it is understood by the interpreter.
In python, the file graminit.c seems to implement the grammar, but i don't clearly understand it.
More broadly, what are the different ways to generate a grammar and are there differences between how the grammar is implemented in l...
I have this grammar of a C# like language, and I want to make a parser for it, but when I put the grammar it tells me about Shift/Reduce conflicts. I tried to fix some but I can't seem to find another way to improve this grammar. Any help would be greatly appreciated :D Here's the grammar:
Program: Decl
| Program Decl
;
D...
On the login page where you usually put a link for requesting/resetting the password. What caption should be used for such link. I see both in use and not sure which one is grammatically and semantically correct.
...