; the grammar is as follows: ; ::= ("<" | ">" | "<=" | ">=" | "=" | "<>") ; ::= {("+" | "-") } ; ::= {("*" | "/") } ; ::= {"^" } ; ::= | ("-" | "+") | "(" ")" | ; "(" ")" ; ::= SIN | COS | TAN | ATN | EXP | ABS | LOG | SQR | RND | INT ; below is an association list indicating what Scheme procedure to call ; for each BASIC function (define functions '((SIN . sin) (COS . cos) (TAN . tan) (ATN . atan) (EXP . exp) (ABS . abs) (LOG . log) (SQR . sqrt) (RND . rand) (INT . trunc))) ; have to define our own random number function because BASIC ignores its ; argument (define (rand n) (random)) ; have to define our own trunc function because BASIC returns an int (define (trunc n) (inexact->exact (truncate n)))