tree: 82e7939f150814030a24b431a8073752b6e8b12b [path history] [tgz]
  1. .gitignore
  2. local.mk
  3. Makefile
  4. parse.y
  5. README.md
  6. reccalc.test
  7. scan.l
examples/c/reccalc/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;
  }