help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grammar for propositional logic


From: John P. Hartmann
Subject: Re: grammar for propositional logic
Date: Wed, 1 Sep 2010 11:23:51 +0200

Unless you've changed the grammar, you are missing a rule to match
formulas followed by a new line.

formulas
        : formula
        | formulas '\n'
        | formulas '\n' formula
        ;

   j.

On 1 September 2010 11:11, Martin McDermott
<address@hidden> wrote:
> Your right, I undid one to many lines and killed it... Sorry about that.
>
> At first I thought I understood the error, I thought it was a problem when
> you have cases like 3 variables but 2 operations. The easier 2 variables and
> 1 op also fails, so now i"m not sure what its telling me. The output is
> below.
>
> Thanks again guys
>
> --(end of buffer or a NUL)
> --accepting rule at line 33 ("p")
> --accepting rule at line 36 (" ")
> --accepting rule at line 25 ("OR")
> --accepting rule at line 36 (" ")
> --accepting rule at line 33 ("q")
> --accepting rule at line 36 (" ")
> --accepting rule at line 25 ("OR")
> --accepting rule at line 36 (" ")
> --accepting rule at line 33 ("r")
> --accepting rule at line 37 ("
> ")
>
> --accepting rule at line 33 ("p")
> --accepting rule at line 36 (" ")
> --accepting rule at line 22 ("AND")
> --accepting rule at line 36 (" ")
> --accepting rule at line 33 ("q")
> --accepting rule at line 37 ("
> ")
>
> --accepting rule at line 28 ("NOT")
> --accepting rule at line 36 (" ")
> --accepting rule at line 33 ("r")
> --accepting rule at line 37 ("
> ")
>
> --(end of buffer or a NUL)
> --EOF (start condition 0)
> syntax error, unexpected $end, expecting T_TRUE or T_FALSE or T_NOT or
> T_VARIABLE
>
>
> On Wed, Sep 1, 2010 at 4:01 AM, John P. Hartmann <address@hidden>
> wrote:
>>
>> You didn't turn on debugging in flex, which is why it doesn't tell you
>> anything.
>>
>> Assuming you don't care about whitespace, you need to split the rule
>> on line 39 into
>>
>> [ \t\r]               ;
>> [\n]                 {lexEcho("%s", yytext); return yytext[0];}
>>
>> The default rule needs to return something or abort the parse.  You
>> might return T_ERROR in case you'd like to find more than one error a
>> throw.
>>
>>   j.
>>
>> On 1 September 2010 09:43, Martin McDermott
>> <address@hidden> wrote:
>> > Flex doesn't give me any output and looking online it looks like
>> > whitespace
>> > wouldn't be causing this. For everything else I used the "." to have
>> > misc
>> > things printed out.
>> >
>> > So I'm not sure how thats possible or where its coming from. I attached
>> > the
>> > file in case anyone feels like taking a look.
>> >
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]