[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
When data types must be read in strict sequence?
From: |
joe |
Subject: |
When data types must be read in strict sequence? |
Date: |
Mon, 3 Aug 2009 19:50:22 +0100 (BST) |
User-agent: |
SquirrelMail/1.4.13 |
Thanks for your help.
I have attached the latest listing of the program in question. When I run
Bison now, then the messages I get from that are...
parse.y: warning: 8 useless nonterminals and 30 useless rules
parse.y:52.1-7: fatal error: start symbol grammar does not derive any
sentence
The particular code it refers to is...
%%
grammar: domains
constants
predicates
;
My intention is that it reads a set of domains...
typically each one to a line of a format...
D0 11 0 10 // domainName, number_of_values, floor_value, ceil_value
...
Then reads a set of constants...
typically each one to a line of a format...
X0 D0 9
Then reads and processes a set of predicates, each one to a line, which
may appear as...
or(lt(mul(X0,X1),X2),ge(abs(sub(X3,X4)),X5))
However, I have no precedent or pro-forma for such as 'grammar' above. I
think that the domains constants predicates sequence will read all the
domains, then all the constants then all the predicates without allowing
any regression (eg a constant in domains) through any of them.
That the start symbol 'grammar' cannot derive any sentence only suggests
to me that the grammar high level nonTerminal cannot access it's
subsidiary terminals and non-terminals.
The classic example such as p75 of lex & yacc...[1995 Levine et al]
statement_list: statement '\n'
statement_list statement '\n'
;
...doesn't shed much light on my requirement below, where I must read a
group of domains, followed by a group of constants, followed by a group of
predicates.
> On Mon, 3 Aug 2009, address@hidden wrote:
>
>> Results from Google re
>> Your search - gnu bison "$$ of `constant' has no declared type" - did
>> not
>> match any documents.
>
> `constant' is specific to your grammar. Try removing the quotes around
> the entire expression.
>
>> The screen message is..
>> parse.y:98.43-44: $$ of `constant' has no declared type
>>
>> Line 98 in the grammar looks like...
>> exp: MAX '(' exp ',' exp ')' { $$ = (($3 > $5) ? $3 : $5 );}
>>
>> There are other complaints about line 98, which don't seem clear...
>> parse.y:98.55-56: integer out of range: `$5'
>> parse.y:98.66-67: integer out of range: `$5'
>
> The real problem is the very last error message:
>
> parse.y:74.48-208.0: missing `}' at end of file
>
> The semantic action that begins on line 74 is never closed, so all
> following actions appear to be part of it. The action on line 98 is for a
> rule with 6 RHS symbols and contains a $5, but the rule for line 74's
> semantic action has only 3 RHS symbols.
>
> It looks like you're using Bison 2.3 or earlier. Later versions of Bison
> only report the missing `}'.
>
parse.y
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- When data types must be read in strict sequence?,
joe <=