Hi,
some time ago I designed a flex + bison system for an embedded system
for which I needed selective compilation -- different systems needed
different language subsets of my flex and bison files. I threw together
a solution using the C preprocessor to selective compile in only the
relevant stuff
Hi Bob,
use the macro YYERROR;
It's documented here:
https://www.gnu.org/software/bison/manual/html_node/GLR-Semantic-Actions.html#YYERROR
Yours,
Alex
On 10/24/2014 03:10 PM, Bob Rossi wrote:
> Hi,
>
> I have a rule like this,
>
> output: output_variant NEWLINE {
> *gdbmi_output = $1;
>
Hi John,
I guess your "strdup" eats the memory. You need to manage this dynamic
memory somewhere in the parser/your program.
Maybe interesting for you: in case of automated parser recovery, bison
offers %destructor[1] to handle memory of automatically discarded symbols.
[1] http://www.gnu.org/so
Hi Laura,
I would start with a global linked list that is filled in the semantic
actions. Building on your example:
%{
#include
#include
typedef struct elem {
char *val;
struct elem *next;
} elem_t;
elem_t *words = NULL;
void add_word(
Hi Laura,
if you want multiple different parsers (i.e. different .y files) in one
binary, use renaming. See the "%name-prefix"-Option.
In this case, I guess you could stick with globals to store the parsing
result.
If you want to use multiple instances of the same parser simultaneously,
turn the
Hi Laura,
yes, sounds perfect.
Yours, Alex
On 04/02/2017 05:02 PM, Laura Morales wrote:
> - if I want multiple parsers, I *must* use prefix change
> - the purpose of a pure/reentrant parser is to encapsulate globals such that
> I can call the same parser multiple times and avoid conflicts or ra
Hi Laura,
the GNU Flex option "%option reentrant" turns the generated scanner into
a reentrant one. This adds the function parameter "yyscan_t yyscanner"
to yylex() to keep the scanner state. The program calling yylex() has to
allocate and prepare a variable of type "yyscan_t" and hand it to
yylex
Hi Owen,
it's not an explanation to the problem, but the following patch to
plural.y seems to get it going:
---
diff -Naur plural.y plural.y.fix
--- plural.y
+++ plural.y.fix
@@ -43,6 +43,7 @@
#define YYLEX_PARAM&((struct parse_args
Hi Anand,
Bison expects its input to come from a lexer, i.e. all inputs are valid
tokens of the language Bison parses. If a token cannot be "matched", the
input is invalid.
If you want to be able to skip any input that is not a valid token, you
have to skip it in the lexer.
Yours
Alex
On 27.04.
Hi David,
have a look at the %parse-param directive:
https://www.gnu.org/software/bison/manual/bison.html#C_002b_002b-Parser-Interface
Yours,
Alex
On 13.08.2018 22:30, David Barto wrote:
> I’m not a bison/yacc/flex expert. I probably don’t even qualify as a novice.
>
> We have some very (very v
Hi Anand,
right, please also have a look at the manual on YYMAXDEPTH[1].
And "you should always use left recursion, because it can parse a
sequence of any number of elements with bounded stack space."[2]
(Sure, when implementing "calculators", using right recursion may make
your life easier with
t&c=Global_Internal_YGrowth_AndroidEmailSig__AndroidUsers&af_wl=ym&af_sub1=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature>
>
> On Wed, 14 Aug 2019 at 16:02, Martin Alexander Neumann
> wrote:
> Hi Mark,
>
> please have a
=Internal&af_sub2=Global_YGrowth&af_sub3=EmailSignature>
>
> On Wed, 14 Aug 2019 at 16:44, Martin Alexander Neumann
> wrote:
> Hi Mark,
>
> ah, yypush_parse does not take a pointer to yylex as second parameter,
> the second parameter is the
Good morning Christian,
during reductions Bison does "hand over" a single semantic value only
from the right side of your productions to the left side of the
productions. By default it is the first, i.e. "$$ = $1" in Bison terms.
I suppose your productions of array_vals look like the following:
14 matches
Mail list logo