help-bison
[Top][All Lists]
Advanced

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

Re: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonh


From: Akim Demaille
Subject: Re: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-object]
Date: Tue, 19 Jan 2021 06:47:06 +0100

Christoph,

FWIW, it appears that Bison is vastly underused in this grammar.
For instance, all these occurrences of $<str> should just read
$$ or $1.  Who is in charge of maintaining the parsers in there?

Start:
  GoalWithOptionalBackSlash {
    $<str>$ = 0;
    yyGetParser->SetResult($<str>1);
  }

GoalWithOptionalBackSlash:
  Goal {
    $<str>$ = $<str>1;
  }
| Goal cal_BSLASH {
    $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
  }

Goal:
  {
    $<str>$ = 0;
  }
| String Goal {
    $<str>$ = yyGetParser->CombineUnions($<str>1, $<str>2);
  }


Not to below that here the actions are simply useless.

String:
  OuterText {
    $<str>$ = $<str>1;
  }
| Variable {
    $<str>$ = $<str>1;
  }

it should be

String:
  OuterText
| Variable
;




OuterText:
  cal_NAME {
    $<str>$ = $<str>1;
  }
| cal_AT {
    $<str>$ = $<str>1;
  }
| cal_DOLLAR {
    $<str>$ = $<str>1;
  }
[and so on and so on...]



reply via email to

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