Files
bison/examples/c/reccalc/README.md
Akim Demaille 8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00

1.3 KiB

reccalc - recursive calculator with Flex and Bison

In this example the generated parser is pure and reentrant: it can be used concurrently in different threads, or recursively. As a proof of this reentrancy, expressions in parenthesis are tokenized as strings, and then recursively parsed from the parser:

exp: STR
  {
    result r = parse_string ($1);
    free ($1);
    if (r.nerrs)
      {
        res->nerrs += r.nerrs;
        YYERROR;
      }
    else
      $$ = r.value;
  }