ubuntu-buildroot/output/host/share/doc/bison/examples/c/reccalc
chenyf 8b0660016e 1 2024-04-01 23:19:46 +08:00
..
Makefile 1 2024-04-01 23:19:46 +08:00
README.md 1 2024-04-01 23:19:46 +08:00
parse.y 1 2024-04-01 23:19:46 +08:00
scan.l 1 2024-04-01 23:19:46 +08:00

README.md

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;
  }