Commit 7abc2604 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

* examples/bddcalc/parser.yxx (actionSeq, varlist): Rewrite as

left-recursive rules.
parent 4cbc1d88
2004-07-12 Alexandre Duret-Lutz <adl@src.lip6.fr>
* examples/bddcalc/parser.yxx (actionSeq, varlist): Rewrite as
left-recursive rules.
2004-06-28 Alexandre Duret-Lutz <adl@src.lip6.fr> 2004-06-28 Alexandre Duret-Lutz <adl@src.lip6.fr>
Merge BuDDy 2.3. Merge BuDDy 2.3.
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
/* Definitions for storing and caching of identifiers */ /* Definitions for storing and caching of identifiers */
#define inputTag 0 #define inputTag 0
#define exprTag 1 #define exprTag 1
struct nodeData struct nodeData
{ {
nodeData(const nodeData &d) { tag=d.tag; name=sdup(d.name); val=d.val; } nodeData(const nodeData &d) { tag=d.tag; name=sdup(d.name); val=d.val; }
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
int linenum; int linenum;
bddgbchandler gbcHandler = bdd_default_gbchandler; bddgbchandler gbcHandler = bdd_default_gbchandler;
/* Prototypes */ /* Prototypes */
void actInit(token *nodes, token *cache); void actInit(token *nodes, token *cache);
void actInputs(void); void actInputs(void);
...@@ -48,7 +48,7 @@ void actAssign(token *id, token *expr); ...@@ -48,7 +48,7 @@ void actAssign(token *id, token *expr);
void actOpr2(token *res, token *left, token *right, int opr); void actOpr2(token *res, token *left, token *right, int opr);
void actNot(token *res, token *right); void actNot(token *res, token *right);
void actId(token *res, token *id); void actId(token *res, token *id);
void actConst(token *res, int); void actConst(token *res, int);
void actSize(token *id); void actSize(token *id);
void actDot(token *fname, token *id); void actDot(token *fname, token *id);
void actAutoreorder(token *times, token *method); void actAutoreorder(token *times, token *method);
...@@ -59,7 +59,7 @@ void actForall(token *res, token *var, token *expr); ...@@ -59,7 +59,7 @@ void actForall(token *res, token *var, token *expr);
void actQuantVar2(token *res, token *id, token *list); void actQuantVar2(token *res, token *id, token *list);
void actQuantVar1(token *res, token *id); void actQuantVar1(token *res, token *id);
void actPrint(token *id); void actPrint(token *id);
%} %}
/************************************************************************* /*************************************************************************
...@@ -119,7 +119,7 @@ actions: ...@@ -119,7 +119,7 @@ actions:
; ;
actionSeq: actionSeq:
action T_semi actionSeq actionSeq action T_semi
| action T_semi | action T_semi
; ;
...@@ -159,7 +159,7 @@ quantifier: ...@@ -159,7 +159,7 @@ quantifier:
; ;
varlist: varlist:
T_id varlist { actQuantVar2(&$$,&$1,&$2); } varlist T_id { actQuantVar2(&$$,&$2,&$1); }
| T_id { actQuantVar1(&$$,&$1); } | T_id { actQuantVar1(&$$,&$1); }
; ;
...@@ -212,7 +212,7 @@ void usage(void) ...@@ -212,7 +212,7 @@ void usage(void)
int main(int ac, char **av) int main(int ac, char **av)
{ {
int c; int c;
while ((c=getopt(ac, av, "hg")) != EOF) while ((c=getopt(ac, av, "hg")) != EOF)
{ {
switch (c) switch (c)
...@@ -225,7 +225,7 @@ int main(int ac, char **av) ...@@ -225,7 +225,7 @@ int main(int ac, char **av)
break; break;
} }
} }
if (optind >= ac) if (optind >= ac)
usage(); usage();
...@@ -242,7 +242,7 @@ int main(int ac, char **av) ...@@ -242,7 +242,7 @@ int main(int ac, char **av)
bdd_printstat(); bdd_printstat();
bdd_done(); bdd_done();
return 0; return 0;
} }
...@@ -279,7 +279,7 @@ void actInputs(void) ...@@ -279,7 +279,7 @@ void actInputs(void)
{ {
if (names.exists((*i).name)) if (names.exists((*i).name))
yyerror("Redefinition of input %s", (*i).name); yyerror("Redefinition of input %s", (*i).name);
(*i).val = bdd_ithvar(vnum); (*i).val = bdd_ithvar(vnum);
hashData hd((*i).name, 0, &(*i)); hashData hd((*i).name, 0, &(*i));
names.add(hd); names.add(hd);
...@@ -299,7 +299,7 @@ void actAssign(token *id, token *expr) ...@@ -299,7 +299,7 @@ void actAssign(token *id, token *expr)
{ {
if (names.exists(id->id)) if (names.exists(id->id))
yyerror("Redefinition of %s", id->id); yyerror("Redefinition of %s", id->id);
nodeData *d = new nodeData(exprTag, sdup(id->id), *expr->bval); nodeData *d = new nodeData(exprTag, sdup(id->id), *expr->bval);
hashData hd(d->name, 0, d); hashData hd(d->name, 0, d);
names.add(hd); names.add(hd);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment