Petit bug dans la grammaire

This commit is contained in:
Ludovic Jacomme 2002-07-23 10:44:41 +00:00
parent cc462003f8
commit 942970ddc1
3 changed files with 121 additions and 16 deletions

View File

@ -64,10 +64,11 @@ static el_mc tab_mc []=
{"ag" ,_AG}, {"ag" ,_AG},
{"and" ,_AND}, {"and" ,_AND},
{"array" ,ARRAY}, {"array" ,ARRAY},
{"assume" ,_ASSUME},
{"au" ,_AU}, {"au" ,_AU},
{"ax" ,_AX}, {"ax" ,_AX},
{"begin" ,_BEGIN}, {"begin" ,_BEGIN},
{"constant" ,CONSTANT}, {"define" ,_DEFINE},
{"downto" ,DOWNTO}, {"downto" ,DOWNTO},
{"ef" ,_EF}, {"ef" ,_EF},
{"eg" ,_EG}, {"eg" ,_EG},
@ -79,6 +80,7 @@ static el_mc tab_mc []=
{"false" ,_FALSE}, {"false" ,_FALSE},
{"high" ,_HIGH}, {"high" ,_HIGH},
{"ift" ,_IFT}, {"ift" ,_IFT},
{"initial" ,_INITIAL},
{"is" ,IS}, {"is" ,IS},
{"left" ,_LEFT}, {"left" ,_LEFT},
{"length" ,_LENGTH}, {"length" ,_LENGTH},

View File

@ -86,8 +86,6 @@ ctlfig_list *loadctlfig( InputFileName )
int Value; int Value;
int Index; int Index;
fprintf( stdout, "loadctlfig InputFileName %s\n", InputFileName );
ctp_y_in = mbkfopen( InputFileName, "ctl", "r" ); ctp_y_in = mbkfopen( InputFileName, "ctl", "r" );
if ( ctp_y_in == (FILE *)0 ) if ( ctp_y_in == (FILE *)0 )

View File

@ -130,7 +130,9 @@
%token <valu> CASE %token <valu> CASE
%token <valu> COMPONENT %token <valu> COMPONENT
%token <valu> CONFIGURATION %token <valu> CONFIGURATION
%token <valu> CONSTANT %token <valu> _DEFINE
%token <valu> _ASSUME
%token <valu> _INITIAL
%token <text> CharacterLit %token <text> CharacterLit
%token <valu> Colon %token <valu> Colon
%token <valu> Comma %token <valu> Comma
@ -217,7 +219,6 @@
%left DoubleStar %left DoubleStar
%right ABS _NOT %right ABS _NOT
%type <list> .VarAsgn__expression.
%type <list> expression %type <list> expression
%type <list> relation..AND__relation.. %type <list> relation..AND__relation..
%type <list> relation..OR__relation.. %type <list> relation..OR__relation..
@ -334,6 +335,8 @@ ctl_declarative_part
block_declarative_item block_declarative_item
: constant_declaration : constant_declaration
| variable_declaration | variable_declaration
| assumption_declaration
| initial_declaration
| type_declaration | type_declaration
| subtype_declaration | subtype_declaration
| error | error
@ -344,7 +347,7 @@ block_declarative_item
; ;
constant_declaration constant_declaration
: CONSTANT : _DEFINE
Identifier Identifier
Colon Colon
type_mark type_mark
@ -411,16 +414,99 @@ constant_declaration
} }
; ;
assumption_declaration
: _ASSUME
Identifier
constant_VarAsgn__expression constant_VarAsgn__expression
: VarAsgn Semicolon_ERR
expression {
{ $$ = $2; } ctltype_list *Type;
ctldecl_list *CtlAss;
vexexpr *VexValue;
chain_list *HeadChain;
chain_list *ScanChain;
ctp_vexstr *VexStr;
short Signed;
long Left;
long Right;
short Width;
long AttrLeft;
long AttrRight;
VexValue = simpvexexpr( $3.VEX );
Type = val_type( "boolean" );
AttrLeft = -1;
AttrRight = -1;
CtlAss = (ctldecl_list *)ctp_addstr( 'A',0, Type,
VEX_TYPE_BOOLEAN, 0, $2, AttrLeft,AttrRight,VexValue);
Signed = 0;
Left = -1;
Right = -1;
addtab(hshtab,$2,CTP_MODNAM,CTP_SYMDFN,CTP_CSTDFN);
addtab(hshtab,$2,CTP_MODNAM,CTP_TYPDFN,VEX_TYPE_BOOLEAN);
addtab(hshtab,$2,CTP_MODNAM,CTP_WMNDFN,Left);
addtab(hshtab,$2,CTP_MODNAM,CTP_WMXDFN,Right);
addtab(hshtab,$2,CTP_MODNAM,CTP_ATLDFN,AttrLeft);
addtab(hshtab,$2,CTP_MODNAM,CTP_ATRDFN,AttrRight);
addtab(hshtab,$2,CTP_MODNAM,CTP_LBLDFN,0);
addtab(hshtab,$2,CTP_MODNAM,CTP_PNTDFN,(long)CtlAss->VEX_ATOM);
addtab(hshtab,$2,CTP_MODNAM,CTP_SUNDFN,Signed );
}
; ;
.VarAsgn__expression. initial_declaration
: /*empty*/ : _INITIAL
{ $$.VEX = NULL ;} Identifier
| VarAsgn constant_VarAsgn__expression
Semicolon_ERR
{
ctltype_list *Type;
ctldecl_list *CtlAss;
vexexpr *VexValue;
chain_list *HeadChain;
chain_list *ScanChain;
ctp_vexstr *VexStr;
short Signed;
long Left;
long Right;
short Width;
long AttrLeft;
long AttrRight;
VexValue = simpvexexpr( $3.VEX );
Type = val_type( "boolean" );
AttrLeft = -1;
AttrRight = -1;
CtlAss = (ctldecl_list *)ctp_addstr( 'I',0, Type,
VEX_TYPE_BOOLEAN, 0, $2, AttrLeft,AttrRight,VexValue);
Signed = 0;
Left = -1;
Right = -1;
addtab(hshtab,$2,CTP_MODNAM,CTP_SYMDFN,CTP_CSTDFN);
addtab(hshtab,$2,CTP_MODNAM,CTP_TYPDFN,VEX_TYPE_BOOLEAN);
addtab(hshtab,$2,CTP_MODNAM,CTP_WMNDFN,Left);
addtab(hshtab,$2,CTP_MODNAM,CTP_WMXDFN,Right);
addtab(hshtab,$2,CTP_MODNAM,CTP_ATLDFN,AttrLeft);
addtab(hshtab,$2,CTP_MODNAM,CTP_ATRDFN,AttrRight);
addtab(hshtab,$2,CTP_MODNAM,CTP_LBLDFN,0);
addtab(hshtab,$2,CTP_MODNAM,CTP_PNTDFN,(long)CtlAss->VEX_ATOM);
addtab(hshtab,$2,CTP_MODNAM,CTP_SUNDFN,Signed );
}
;
constant_VarAsgn__expression
: VarAsgn
expression expression
{ $$ = $2; } { $$ = $2; }
; ;
@ -431,7 +517,6 @@ variable_declaration
Colon Colon
type_mark type_mark
.constraint. .constraint.
.VarAsgn__expression.
Semicolon_ERR Semicolon_ERR
{ {
char *LocalName; char *LocalName;
@ -2070,7 +2155,7 @@ vexexpr *exp;
if ( object == 'C' ) if ( object == 'C' )
{ {
CtlDeclar = addctldeclcst( CTP_HEADFIG, vex_pnt ); CtlDeclar = addctldecldef( CTP_HEADFIG, vex_pnt );
CtlDeclar->TYPE = prtype; CtlDeclar->TYPE = prtype;
CtlDeclar->VEX_INIT = exp; CtlDeclar->VEX_INIT = exp;
addctlline( CTP_HEADFIG, &CtlDeclar->LINE, CTP_LINNUM ); addctlline( CTP_HEADFIG, &CtlDeclar->LINE, CTP_LINNUM );
@ -2086,6 +2171,26 @@ vexexpr *exp;
pnt = (void *)CtlDeclar; pnt = (void *)CtlDeclar;
} }
else
if ( object == 'A' )
{
CtlDeclar = addctldeclass( CTP_HEADFIG, vex_pnt );
CtlDeclar->TYPE = prtype;
CtlDeclar->VEX_INIT = exp;
addctlline( CTP_HEADFIG, &CtlDeclar->LINE, CTP_LINNUM );
pnt = (void *)CtlDeclar;
}
else
if ( object == 'I' )
{
CtlDeclar = addctldeclinit( CTP_HEADFIG, vex_pnt );
CtlDeclar->TYPE = prtype;
CtlDeclar->VEX_INIT = exp;
addctlline( CTP_HEADFIG, &CtlDeclar->LINE, CTP_LINNUM );
pnt = (void *)CtlDeclar;
}
return (pnt); return (pnt);
} }