I don't know how familiar you are with this, so apologies if I'm stating
the obvious.
General observations:
1 - start by writing a skeleton with no actions; this makes it easier to
find conflicts. When you're done, add the actions
2 - this is *way*, *way* too verbose. You don't need tokens for '
On 22/09/2022 21:34, Derek Clegg wrote:
This is horrid, and not how math works. Spaces necessarily mean nothing, and
imbuing them with meaning is nonsense.
Please reconsider your grammar.
It's a programming language, not maths. There are, of course, languages
in which spaces necessarily mean
I'd like to pass a token class from Flex to Bison (ideally, a
tr1::shared_ptr - a reference counted smart pointer class). However, in
Bison itself I need to deal with a number of symbol types - tokens, AST
nodes, and so on.
This means that I need to use a %union, but this is difficult because
Thanks for the input on this. I can't really use the pointer solutions,
so my current fix is to define YYSTYPE as a struct, rather than a union,
and to pass around classes in the struct. This seems to work well,
though it's inefficient.
The reason that reference counting is required here is th
I've got a problem where I need some communication back from Bison to
Flex (in this case, I need Flex to return two different tokens for the
same input, depending on context).
The procedure is something like:
1 - parser determines context and sets global flag for lexer
2 - lexer checks flag,
Thanks Tim. At first sight, this fix should be exactly what I need;
however, in my case, it doesn't work... :(
The problem is that COBOL has a real keyword - FUNCTION - to 'lock on'
to. So, in your production:
xxx
: { recognize_function_names = true; } FUNCTION valid_function
;
the lexer c
Hans Aberg wrote:
On 19 Jul 2005, at 17:01, Evan Lavelle wrote:
The only way that I know a new function is coming up is that an
existing function has just completed: there's no convenient keyword
to give me warning. [If my grammar really was this simple, then I
could probably use an
struct yystype {
...
antlr::RefToken tok;
antlr::RefASTast;
};
#define YYSTYPE yystype
Evan
___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
Frans Englich wrote:
On Friday 16 September 2005 20:28, Evan Lavelle wrote:
struct yystype {
...
antlr::RefToken tok;
antlr::RefASTast;
};
#define YYSTYPE yystype
Yupp, that is an attractive solution from a memory management perspective.
However, I have trouble with
Arlen Cox wrote:
I am trying to implement a grammar that may have 0 or more of a construct.
Effectively I want to have a grammar like this:
File:
( Module )*
File :
/* nothing */
| File Module
;
Google 'left recursion', or converting between LALR and LL grammars (or
LR and LL). T
Hi - is there any way to programatically force reduction of a rule,
bypassing the normal mechanism? This might be a useful way to resolve
some conflicts.
Thanks -
Evan
___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
A couple of things to watch out for:
[[:alnum:]]+yylval = yytext; return WORD;
^.*$yylval = yytext; return STRING;
what are you trying to match here? Is your reasoning that any
alphanumeric will get caught in the 1st rule, and everything else in the
2nd? This
Henrik Sorensen wrote:
On Friday 13 January 2006 13.10, Steve Murphy wrote:
One that would be nice to smooth out would be the start-condition
capability in flex... and how to trigger it from the bison grammar end
of things.
Can you be more specific why you want to do this ?
It gives you mu
Henrik Sorensen wrote:
For the pl1 problem, I cheated a bit with flex, and when certain conditions
are met I simply save all the token met, and then change them to what I need
before returning the tokens to bison. If you are interested in more feel free
to contact me, or better look at the cod
Hans Aberg wrote:
Once upon the time, Bison had an informal support for the C-parser to be
compiled as C++, but this was dropped, being too difficult to maintain.
Instead, a separate C++ skeleton was developed.
So, for C++, it is best to use the C++ skeleton file.
I have a lot of C++ code i
Akim Demaille wrote:
I suggest that you do not: Joel is already planning to work on this,
that would be duplicate work. But see
http://www.gnu.org/software/soc-projects/ideas.html for other
suggestions. If you are fluent in XML, the last one would be
particularly useful :)
nice to see
# On
I'm just about to write a yylex wrapper to let me push back a token so
that Bison can re-read it. Before I do this, can anyone tell me if
there's a better way to handle this?
My problem is that I need to write a partial parser, which ignores large
chunks of a language. The chunks are delimited
Devin Landes wrote:
I was thinking about defining YYPARSE_PARAM or maybe looking into
getting the Microsoft compiler to define __STDC__. Any suggestions on a
Good workaround? Apparently bison 2.3 solves this problem but GnuWin32
doesn't support 2.3 yet. Any thoughts are appreciated.
What compi
Root: Prolog
Prolog: FirstProlog SecondProlog
FirstProlog: /* empty */
| FirstProlog A
SecondProlog: /* empty */
| SecondProlog B
A: DECLARE FOO
B: DECLARE BAR
How about this:
Root: Prolog;
Prolog
: FirstPrologList
| SecondPrologList
| FirstPrologList SecondPrologList
;
Fir
Evan Lavelle wrote:
Prolog
: FirstPrologList
| SecondPrologList
| FirstPrologList SecondPrologList
;
I missed the case of no prolog at all, but this has no conflicts:
Prolog
: /* nothing */
| FirstPrologList
| SecondPrologList
| FirstPrologList SecondPrologList
;
Evan
Fernando Ferreira wrote:
The reason for my request is that, as bison generates LR parsers, there
is no way to, for instance, execute an action before a rule is reduced,
only after.
I've never tried an action at the start of a rule, but I'm pretty sure
that you can do it. Look up 'embedded ac
Hans Aberg wrote:
http://savannah.gnu.org/svn/?group=bison
"Error: this project has turned off this tool" ?!
I sympathise. If I ever get enough time, I'll probably be converting
back from svn to cvs.
Evan
___
help-bison@gnu.org http://lists.g
Hans Aberg wrote:
On 9 Aug 2007, at 10:55, Evan Lavelle wrote:
http://savannah.gnu.org/svn/?group=bison
"Error: this project has turned off this tool" ?!
I sympathise. If I ever get enough time, I'll probably be converting
back from svn to cvs.
What are the cons and
You don't give enough information. Here's a couple of things to try:
1 - your grammar already has the precedence rules encoded in its
structure. It's obvious, for example, that unary expressions have higher
precedence than summation expressions. You only use the explicit '%prec'
precedence whe
Arijit Das wrote:
Even though Bison is a bottom up parser, if I need to pass a variable's
content top-down, what are the possible ways (except using global
variable)?
Register_decl
: REGISTER IDENTIFIER Register_decl_contd
{
Char * register_name =
Ramón García wrote:
directed translation" has all the details.. I think that Synopsys, a
company that charges about 1 $ for each software license, can
afford a 30 $ book.
If you can get any Synopsys licences at $10K, then I'll have a shedload
of them...
:)
Actually, it turns out that the conflict is pretty obvious even without
the debug output. consider this input:
"5 6 +4"
How do you expect this to be scanned? Does it contain 3
summation_expressions ("5", "6", "+4") or 2 ("5", "6+4")? There's an
ambiguity - you haven't defined an expression li
cwcaceres wrote:
But I'm not trying to list. I'm trying to do the add operation. So the
expression "5 6 +4" wouldn't be valid. An example of a valid operation would
be "+5 + -6 - -2" which should have an output of 1. My grammar file
currently outputs the correct result.
I agree with trying to re
If you want help with a grammar, you need to do one of two things:
- post a grammar that fails. Put '%%' around it, make sure that there
are no undefined rules, cut out all actions, and run Bison on it. Don't
post everything: if 'expr' isn't relevant, add "expr : 'A' ;", for
example, or
- Sh
It's too big to make much sense of, but here's a couple of things you
can try:
I'd be surprised if it works. Have you tried column_method_name both
with and without brackets? The default is to ignore the brackets - what
happens then? How are the brackets interpreted?
without brackets it is re
I had the same problem on my first language; here's what I did.
I started off thinking that I needed a simple interpreter, so I wrote
the Bison code, and basically did all the required work in the Bison
actions. This worked well; It looks like you're at this stage.
A little later, I realised
Ilyes Gouta wrote:
Basically what it's done is enumerating all the possibilities for the
construction of the for loop. Is it the only way do things clearly and
properly?
There's no 'clear and proper' way to do this; do whatever's best for
you, try it, fix it, repeat. Here's what I do:
itera
Check the logs, as Hans suggests. For starters, though, what's this:
NOT IN ((SELECT '*' FROM SCONST))
What sort of 'search_cond' is it? First branch, second branch, or both?
It can't be both; that's a conflict.
Evan
___
help-bison@gnu.org http://
Evan Lavelle wrote:
Check the logs, as Hans suggests. For starters, though, what's this:
NOT IN ((SELECT '*' FROM SCONST))
What sort of 'search_cond' is it? First branch, second branch, or both?
It can't be both; that's a conflict.
Sorry, didn't read
I had this problem some years ago, when I was first using Bison. I had a
simple language, which I could handle in a single parser pass; this was
easy, and I could do everything in the Bison actions.
I then added some functionality, which was primarily forward-referencing
of externals (mainly f
Matthias Kramm wrote:
I'll probably define myself some C macros so that I can at least
write something like
E = E '+' E {pass2only append($1);append($3);append(OP_ADD);}
.
But it would of course be more nifty if the default behaviour
"execute an action only if the pass is 2" could be placed
You haven't given enough information; it looks like there's an embedded
action you've left out. Construct a simple test case and post it.
Alternatively, just start with the production as shown in SV3.1a:
timeunits_declaration
: timeunit time_literal ';'
| timeprecision time_literal ';'
Sanity check: presumably you know that you don't have to build on MSYS
to get a Win32 executable? You can build on Cygwin, with MinGW. You can
ignore MSYS completely, and the result doesn't use cygwin.dll.
-Evan
___
help-bison@gnu.org http://lists.g
Dick Dunbar wrote:
I didn't know that. And don't know how to proceed. I have gcc installed on
cygwin;
does it need to be replaced with a MinGW distro? Any pointers to a
discussion of this?
No; just install the MinGW gcc. You can get this from the Cygwin
installer, but I think I downloaded
You're making this way, way, too complicated. Cut down your code into a
50-line example that doesn't work, with an example of an input that
shows right-associativity (try a=b-c-d rather than a=b+c+d). By the time
you've done this, you'll almost certainly have fixed the problem
yourself. If not,
On 17 Dec 2010, at 17:08, Gergely Feldhoffer wrote:
Thank you, we upgraded bison from latest debian 2.4.1 to 2.4.3, and it
works just fine.
I just had this problem on the default Ubuntu 10.10 installation (gcc
4.4.5, bison 2.4.1). Anyone who wants to stay on 2.4.1 needs to edit the
location.
On 07/02/2011 23:13, Tejas Kajarekar wrote:
Hi Martin,
If I understand your question correctly, here is a way to have multiple
scanners and parsers in the same program.
No, he's asking about using a subset of an existing grammar in a new parser.
Example: I have a language which includes a comp
If there are only 3 mandatory blocks then, in principle, you can look
for all possible combinations in the input:
message
: M1 M2 M3
| M1 M3 M2
| M2 M1 M3
| M2 M3 M1
| M3 M1 M2
| M3 M2 M1
;
However, you've got a problem in that you need 'at least one' of the
mandatory blocks, and
What is 'design_file'?
Does it expect a START_FULL before LIBRARY?
Is 'switch' invoked anywhere else?
Do you have any 'go to state 0' output in your debug file?
Does START_FULL appear anywhere else in your grammar?
Which 'modification' are you removing? Both, or just the start rule?
-Evan
__
If your parser knows that it's dealing with a statement, you could try
lexical feedback (look up "lexical tie-ins" in the bison docs, and
google "scanner feedback" or "lexical feedback"). The parser sets a flag
to tell the lexer that it's inside a statement, and the lexer then
returns the NL wh
You'll never get an answer from the FSF on licensing; they'll just send
you a form mail asking you for money. So, don't bother asking.
You have to ask yourself two questions:
1 - Is filebench a parser generator? From what you've said, it seems
that it isn't. If it isn't a parser generator (ie.
On 02/08/2012 07:25, Akim Demaille wrote:
Hi all,
Dropping CC is quite impolite, especially when it is to write about
the missing person.
Apologies if I missed out anyone. It seemed to me that most people were
getting at least two copies of the email.
I don't know them, but I believe that
On 05/02/2013 23:54, Adam Smalin wrote:
This doesn't help :( I see >> is in the lexer (search SHL) which means
List> will not compile because >> is a right shift. But i looked
in the y file first and well... like i said its a C++ problem so C++
obviously would suffer from it.
Why have you got a
This is perhaps more canonical:
param_list
: /* nothing */ { $$ = new ParamListNode(); }
| param_item_list{ $$ = $1; }
;
param_item_list
: param { $$ = new ParamListNode($1); }
| param_item_list ',' param { $$ = $1->addChild($3); }
Any idea how to fix this? I have a grammar which compiled without
problems on bison 2.4.1/gcc 4.4.7 (RHEL 6.5), but which won't now
compile on bison 3.0.2/gcc 4.8.2 (Ubuntu 14.04).
The bison.tab.cc output from 2.4.1 included a definition of yylval as:
semantic_type yylval;
The 3.0.2 output ha
Ubuntu 14.04, building 2.4.1 from source (yes, I know 2.4.1 is old, but
(1) at least appears to be just a config problem):
1 - Can't make bison.texinfo, with makeinfo/texinfo installed (can avoid
by preventing a docs and examples build by modifying docs/Makefile and
examples/Makefile)
2 - wh
On 26/11/2014 07:11, sean nakasone wrote:
Hi, in ielr.c , there's comments that refer to things like: \post, \pre, \c .
Doxygen: http://www.stack.nl/~dimitri/doxygen/index.html
http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdpre
http://www.stack.nl/~dimitri/doxygen/manual/command
Great - thank you.
On 01/04/2020 07:20, Akim Demaille wrote:
> Hi,
>
>> Le 31 mars 2020 à 21:05, EML a écrit :
>>
>> This doesn't compile on RHEL 6.10/gcc 4.4.7, with "#pragma GCC
>> diagnostic not allowed inside functions". I've 'fixed' this with the
>> hack at https://trac.macports.org/ticket/
.
On 02/04/2020 06:30, Akim Demaille wrote:
> Hi,
>
>> Le 1 avr. 2020 à 10:12, Evan Lavelle a écrit :
>>
>> Great - thank you.
>
> Could you please try these?
>
> https://www.lrde.epita.fr/~akim/private/bison/bison-3.5.3.3-6e89b.tar.gz
> https://www.l
Ubuntu 16 (gcc 5.4.0): Ok
SLES 12 (gcc 4.8.5): Ok
RHEL 7.7 (gcc 4.8.5): Ok
All report the bison version as 3.5.3.3-6e89b when run.
On 02/04/2020 10:53, Evan Lavelle wrote:
> Hi Akim - yes, that builds cleanly (with no warnings) on Scientific
> Linux 6.10 (an RHEL 6.10 clone), with a d
55 matches
Mail list logo