Re: Debugging "$4"

2020-10-07 Thread Chris verBurg
I don’t know if this is helpful, but is there a problem with ambiguity between these parses: (IF 1=1 THEN PRINT “3” ) : PRINT “4” and IF 1=1 THEN (PRINT “3” : PRINT “4”) ? Because if the shift/reduce conflict resolved toward the first one, then $4 really only has one statement anyway. -Ch

Re: Parsing '\x00' -- appears to be the only thing preventing parsing binary data

2021-03-30 Thread Chris verBurg
I don’t know how you’ve set up your flex/bison interface, but I’m guessing from your quoting that you have flex return each character as a token? Can you special-case 0 to not have the token value 0? That is, flex does this: \x00 { return ZERO; } And then in your grammar: %token ZERO and

Re: Parsing '\x00' -- appears to be the only thing preventing parsing binary data

2021-03-30 Thread Chris verBurg
for each > function it appears in > Makefile:13: recipe for target 'lex.yy.o' failed > make: *** [lex.yy.o] Error 1 > > > Bison likes it. > Tried quoting the \x00 but thats not right it appears. > > > >> On Mar 30, 2021, at 16:15, Chris verBurg wrote:

Re: Weird Rule Matching

2022-04-06 Thread Chris verBurg
Tom, I'm thinking this is just the "LA" part of "LALR" parsing. Imagine if you had another rule for "if" that included an "else" clause. The parser would need to know if the token after '}' is an "else" or not, because it changes whether it reduces the if-else rule or the just-if rule. Even tho

Re: Syntax error if paragraph contains more than 1 printable character

2023-12-12 Thread Chris verBurg
Hey Steve, My reading of your code is that PARATEXT will only ever be a single character. I'm thinking you want the flex rule to be ".*" (etc) instead of just ".". I'm curious whether your paragraphs are allowed to contain NLs. If so, you're going to have to include them in the PARATEXT token v

Re: Solution to a Flex problem

2023-12-12 Thread Chris verBurg
Indeed - note that flex is more aligned with posix-style patterns than perl-style patterns, so it would rather have "[:space:]", and "\s" just means "s". -Chris On Tue, Dec 12, 2023 at 12:07 AM Steve Litt wrote: > Hi all, > > I know this is a Bison and not a Flex venue, but just in case somebod

Re: Where to put '#define YYSTYPE char *'?

2009-12-27 Thread Chris verBurg
I think that belongs in the flex file (example6.l), not the yacc file (example6.y). -Chris On Sun, Dec 27, 2009 at 9:55 PM, Peng Yu wrote: > I have the following example6.y and example6.l files. The compilation > gives me warnings. I'm not sure where to put '#define YYSTYPE char *' > (it is cu

Re: lookahead and yytext

2010-03-08 Thread Chris verBurg
; issue didn't have the extra single_identifier. Ignore it. > > -Brad > > Chris verBurg wrote: > >> Hey Brad, >> >> Do you mean to have "single_identifier" listed twice for the first >> method_header grammar? That's the only thing I can think

Re: %left is not working

2010-08-04 Thread Chris verBurg
I think I see a few issues in your code, but without the complete source I can't conclusively say what your problem might be. First: > if(strcmp($2, "+")) Just to be sure: you know strcmp returns 0 when the strings match, right? I ask because it looks like you're trying to convert "+" to "add",

Re: %left

2010-08-06 Thread Chris verBurg
On Fri, Aug 6, 2010 at 5:17 AM, Sasan Forghani wrote: > > .. > expr : expr BL_ADDOP expr > ... >char bufferT[6]; > ... >$$ = bufferT; > $$ is a char* isn't it? In which case this assigns it to the temporary bufferT, which is going to get wiped out as soon as it goes out of scope. Maybe

Fwd: how to send data up the stack

2010-08-11 Thread Chris verBurg
(FYI) -- Forwarded message -- From: Sasan Forghani Date: Wed, Aug 11, 2010 at 8:18 AM Subject: Re: how to send data up the stack To: Chris verBurg Phil and Chris thank you for the response. I actually figured out what was wrong last night. I had my printf statements as there

Re: What do you use bison for?

2011-06-05 Thread Chris verBurg
I use flex/bison mainly for creating data-file parsers, such as LEF, DEF, verilog, and liberty files, and the occasional custom file format. I still have yet to use them to parse a programming language. :) -Chris On Sat, Jun 4, 2011 at 8:46 AM, Philip Herron wrote: > Well i am working on my

Re: Error when i try to install qgis1.7

2011-09-23 Thread Chris verBurg
Even though the crash is in a .yy file, an installation problem is something for the qgis team to look at, not help-bison. :( Did they send you over here? -Chris On Fri, Sep 23, 2011 at 9:09 AM, Jules Kouadio wrote: > Hello > > After > cd build-master > cmake .. > make > > I get : > > qgsex

Re: Parsing multiple files with same parser

2012-11-17 Thread Chris verBurg
One thing that's bitten me in the past is that yyrestart doesn't reset the flex start-state. If you have any of those, maybe add a "BEGIN(INITIAL)" to your other flush code? -Chris On Sat, Nov 17, 2012 at 4:56 PM, Tadej Borovšak wrote: > Hi. > > Dne 18.11.2012 (ned) ob 01:20 +0100 je Hans Abe

Re: Identifying start of new rule

2013-06-15 Thread Chris verBurg
Dear Test, I have to start by saying I got a giggle out of your yyerror function, because I saw the "EEK" and figured out it was my tutorial you read through. Awesome! Glad it's still useful. :) I think the core of your problem is this rule: ::= which essentially turns into an arbitrar

Re: [SOLVED with questions] Identifying start of new rule

2013-06-16 Thread Chris verBurg
On Sun, Jun 16, 2013 at 10:17 AM, Test User wrote: > A new grammar in combination with %glr-parser worked. > Woot! Question: > > (1)I understand that if I have a file of the form: > ::= ::= , bison parses my rules by default > as ( ::= ) ::= and generates a syntax error > when it reaches

Re: Tell a rule to shift instead of reduce?

2013-12-17 Thread Chris verBurg
Hey Adam, I have a couple ideas. First, you might try updating the precedence of ',' for just that one rule: | rvalLoop ',' rval %prec '=' (though you might need to define a precedence-level higher than both ',' and '=' for that to work right). A second, more straightforward, idea is to shuffl

Re: Interactive continuation prompting

2014-06-18 Thread Chris verBurg
Hey Grant, I don't know the internals of how python and shells do it, but a project I worked on a long time ago did it a completely different way. They implemented two grammars: one was the real language grammar (used for reading in scripts from files), and the second would parse just an isolated

Re: About the version of bison

2014-12-26 Thread Chris verBurg
Dear 562462894, I would also suggest seeing if your 3.0 version is merely installed somewhere else. Try 'where bison' to see if you get more than one hit. If not, check the output from your install to see where it put it. Then, update your $PATH to put that path in front of the one where your 2

Re: Is handwritten faster?

2015-10-02 Thread Chris verBurg
Hey Adam, My two cents is to paraphrase John Levine's Flex & Bison book (ha! I almost said Adam Levine!): - yes, after tweaking, your manual parser will probably be faster. - but that assumes you put all the necessary time into tweaking - and you put in all the necessary time to get it functionall

Re: [Question] - Is it a good idea to parse groff with Bison?

2015-11-05 Thread Chris verBurg
Whoa, this looks just like a question posted in Stackoverflow a few hours ago! :) A cursory googling gives me evidence that groff itself uses bison, which would make jison a good match for parsing it, yes. -Chris On Thu, Nov 5, 2015 at 3:24 PM, Roberto Jesus Dip wrote: > Hello everyone, > >

Re: [Question] - Is it a good idea to parse groff with Bison?

2015-11-06 Thread Chris verBurg
f its really a good idea to use it. > > Thanks again! > > On Fri, Nov 6, 2015 at 3:46 AM, Chris verBurg > wrote: > >> >> Whoa, this looks just like a question posted in Stackoverflow a few hours >> ago! :) >> >> A cursory googling gives me evidence

Re: Tutorial or Article

2016-03-02 Thread Chris verBurg
Hey Stephen, I don't know that we see enough of your code to say for sure what's going on, but my limited guess is that if "if_group" is your top-level pattern, then it'll never understand ELSE because else_group is not referenced anywhere downstream of if_group. If so, what about having the elem

Re: memory problem

2016-09-22 Thread Chris verBurg
I'm not sure there's a Bison limit -- tokens should be allocated by the lexer (flex), and user code has full control over how big to make buffers and char*s.. Or by "Bison input" do you mean the .y file, and it's a grammar rule that exceeds 4096 characters? -Chris On Thu, Sep 22, 2016 at 8:20 A

Re: Error with grammar arguments

2018-12-18 Thread Chris verBurg
Rob, To ask a sanity question, you do strdup (or otherwise allocate fresh memory for) yytext on the Flex side when returning tokens, yes? -Chris On Tue, Dec 18, 2018 at 9:15 AM Rob Casey wrote: > Hello, > > I have a (large) grammar where I have code similar to that below: > > | identifier