DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(bison.info) Rpcalc Line

Info Catalog (bison.info) Rpcalc Input (bison.info) Rpcalc Rules (bison.info) Rpcalc Expr
 
 Explanation of `line'
 .....................
 
    Now consider the definition of `line':
 
      line:     '\n'
              | exp '\n'  { printf ("\t%.10g\n", $1); }
      ;
 
    The first alternative is a token which is a newline character; this
 means that rpcalc accepts a blank line (and ignores it, since there is
 no action).  The second alternative is an expression followed by a
 newline.  This is the alternative that makes rpcalc useful.  The
 semantic value of the `exp' grouping is the value of `$1' because the
 `exp' in question is the first symbol in the alternative.  The action
 prints this value, which is the result of the computation the user
 asked for.
 
    This action is unusual because it does not assign a value to `$$'.
 As a consequence, the semantic value associated with the `line' is
 uninitialized (its value will be unpredictable).  This would be a bug if
 that value were ever used, but we don't use it: once rpcalc has printed
 the value of the user's input line, that value is no longer needed.
 
Info Catalog (bison.info) Rpcalc Input (bison.info) Rpcalc Rules (bison.info) Rpcalc Expr
automatically generated byinfo2html