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

Interpreting T
(finalized in class)

The language T0

  Expr       ::= Num | Paren | BinOp | ParityExpr
  Paren      ::= < Expr >
  BinOp      ::= # Op Expr Op Expr Expr #
  Op         ::= boii | boi | boiii   interpretation: add, subtract, multiply (resp.)
  ParityExpr ::= even? Expr dope Expr nope Expr dawg
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 (interpretation):


Discussion


Where we're headed

T0 Implementations


Discuss the implementation

Once we've talked in class about internal-representation (and given examples of the T programs and corresponding internal-data), then we can discuss the provided-implementation, including recursive-descent parsing:


1 This 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 T0's arithmetic will be similar to IEEE floating point arithmetic (rather than perfectly-correct arithmetic).

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

     

logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.