![]() |
![]() |
|
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
Expr ::= Num | Paren | BinOp | Parity Paren ::= < Expr > BinOp ::= | Expr Expr Op | Parity ::= / Expr Expr Expr \ Op ::= ;) | ;( | xD |
Semantics:
Note:Download the racket files, and then choose Open… from DrRacket. Do not copy/paste into an empty DrRacket window, since that window is probably using a student-language, and some of the files below use full racket.
TODO (once):If your DrRacket prints 1.25 as “(This tip deleted, since it was not the actual problem.)5/4 ” …
Note: If you downloaded R0.rkt before Mon. 17:00, and(expr->string (parse! "1.2")) doesn't return"1.2" then you'll want to make sure the first line ofexpr->string is:(cond [(number? e) (number->string (if (integer? e) e (exact->inexact e)))] … .
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
Similarly, if using Java, the semantics of R0's arithmetic will be similar to IEEE floating point arithmetic (rather than perfectly-correct arithmetic).
Don't confuse R0's class
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
©2016, Ian Barland, Radford University Last modified 2016.Nov.14 (Mon) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |