PasteRack.org
Paste # 23429
2018-05-13 14:48:56

Fork as a new paste.

Paste viewed 414 times.


Embed:

  1. #lang racket
  2.  
  3. (define arith-grammar
  4.   (append num-grammar
  5.      '([add-expr {ADD-MANY   mult-expr (token #\+) arith-expr}]
  6.        [sub-expr {SUB-MANY mult-expr (token #\-) arith-expr}]
  7.        [mult-expr {MULT-MANY base-expr (token #\*) arith-expr}
  8.                   {MULT-SINGLE base-expr}]
  9.        [div-expr {DIV-MANY mult-expr (token #\/) arith-expr}]
  10.        [arith-expr {ARITH-ADD add-expr}
  11.                    {ARITH-SUB sub-expr}
  12.                    {ARITH-DIV div-expr}
  13.                    {ARITH-MULT mult-expr}
  14.                    {ARITH-BASE base-expr}]
  15.        [base-expr {BASE-NUM numb}
  16.                   {PARENS (token #\() arith-expr (token #\))}])))

=>

num-grammar: undefined;

 cannot reference an identifier before its definition

  in module: 'm