8.10
4.1.8 v6.5 Languages
| (require cpsc411/langs/v6-5) | package: cpsc411-lib |
exprs-lang-v6.5 : grammar?
| p | ::= | (module (define x (lambda (x ...) value)) ... value) | ||
| pred | ::= | (relop triv triv) | ||
| | | (true) | |||
| | | (false) | |||
| | | (not pred) | |||
| | | (let ([x value] ...) pred) | |||
| | | (if pred pred pred) | |||
| value | ::= | triv | ||
| | | (binop value value) | |||
| | | (let ([x value] ...) value) | |||
| | | (if pred value value) | |||
| | | (call x value ...) | |||
| triv | ::= | x | ||
| | | int64 | |||
| x | ::= | name? | ||
| binop | ::= | * | ||
| | | + | |||
| | | - | |||
| relop | ::= | < | ||
| | | <= | |||
| | | = | |||
| | | >= | |||
| | | > | |||
| | | != | |||
| int64 | ::= | int64? |
procedure
(exprs-lang-v6.5? a) → boolean?
a : any/c
Decides whether a is a valid program in the exprs-lang-v6.5 grammar, represented as a quoted datum. The first non-terminal in the grammar defines valid programs.
procedure
(interp-exprs-lang-v6.5 a) → any/c
a : exprs-lang-v6.5?
Evaluates a exprs-lang-v6.5 program to a value.
exprs-unique-lang-v6.5 : grammar?
| p | ::= | (module (define label (lambda (aloc ...) value)) ... value) | ||
| pred | ::= | (relop opand opand) | ||
| | | (true) | |||
| | | (false) | |||
| | | (not pred) | |||
| | | (let ([aloc e] ...) pred) | |||
| | | (if pred pred pred) | |||
| value | ::= | triv | ||
| | | (binop value value) | |||
| | | (call triv value ...) | |||
| | | (let ([aloc value] ...) value) | |||
| | | (if pred value value) | |||
| opand | ::= | aloc | ||
| | | int64 | |||
| triv | ::= | opand | ||
| | | label | |||
| binop | ::= | * | ||
| | | + | |||
| | | - | |||
| relop | ::= | < | ||
| | | <= | |||
| | | = | |||
| | | >= | |||
| | | > | |||
| | | != | |||
| aloc | ::= | aloc? | ||
| label | ::= | label? | ||
| int64 | ::= | int64? |
procedure
a : any/c
Decides whether a is a valid program in the exprs-unique-lang-v6.5 grammar, represented as a quoted datum. The first non-terminal in the grammar defines valid programs.
procedure
a : exprs-unique-lang-v6.5?
Evaluates a exprs-unique-lang-v6.5 program to a value.
exprs-unique-lang-v6.5/context : grammar?
| p | ::= | (module (define label (lambda (aloc ...) tail)) ... tail) | ||
| pred | ::= | (relop opand opand) | ||
| | | (true) | |||
| | | (false) | |||
| | | (not pred) | |||
| | | (let ([aloc value] ...) pred) | |||
| | | (if pred pred pred) | |||
| tail | ::= | value | ||
| | | (let ([aloc value] ...) tail) | |||
| | | (if pred tail tail) | |||
| | | (call triv value ...) | |||
| value | ::= | triv | ||
| | | (binop value value) | |||
| | | (let ([aloc value] ...) value) | |||
| | | (if pred value value) | |||
| | | (call triv value ...) | |||
| opand | ::= | aloc | ||
| | | int64 | |||
| triv | ::= | opand | ||
| | | label | |||
| binop | ::= | * | ||
| | | + | |||
| | | - | |||
| relop | ::= | < | ||
| | | <= | |||
| | | = | |||
| | | >= | |||
| | | > | |||
| | | != | |||
| aloc | ::= | aloc? | ||
| label | ::= | label? | ||
| int64 | ::= | int64? |
procedure
a : any/c
Decides whether a is a valid program in the exprs-unique-lang-v6.5/context grammar, represented as a quoted datum. The first non-terminal in the grammar defines valid programs.
procedure
a : exprs-unique-lang-v6.5/context?
Evaluates a exprs-unique-lang-v6.5/context program to a value.