RU beehive logo ITEC dept promo banner
ITEC 380
2017fall
ibarland

homelecturesrecipeexamshwsD2Lbreeze (snow day; distance)

S0
Interpreting S
(finalized in class)

The language S0

  Expr   ::= Num | Paren | BinOp | Ifnz
  Paren  ::= | Expr |     (note: these “|”s are literal -- not BNF “or”s)
  BinOp  ::= ? Op Expr Expr
  Ifnz   ::= ( Expr ) !0  Expr : Expr 
  Op     ::= ad | su | mu
where Num is any numeric literal (as written in either Java or Racket, your choice1). For the provided parsers to work, whitespace is required between all terminals with the exception of punctuation.

Semantics:


Discussion


Where we're headed

S0 Implementations


1This is so we can just use our language's built-in number-parsing functions, without getting bogged down in tokening input. So racket implementations will allow exactly those strings recognized by number?, (including +nan.0, -inf.0, and 2+3i).

Similarly, if using Java, the semantics of S0's arithmetic will be similar to IEEE floating point arithmetic (rather than perfectly-correct arithmetic).

Don't confuse S0's class Num (which extends Expr) with the existing java.lang.Number, which doesn't extend Expr.

     

homelecturesrecipeexamshwsD2Lbreeze (snow day; distance)


©2017, Ian Barland, Radford University
Last modified 2017.Nov.14 (Tue)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.