Slide 19
Slide 19 text
The 11th Implementation, Compilation,
Optimization of Object-Oriented Languages,
Programs and Systems Workshop
Rome, July 18th 2016
19
Example: lexical addressing
boolean ::= « TRU »
boolean ::= « FLS »
character ::= « CHR , native_character »
integer ::= « INT , native_integer »
real ::= « REA , native_real »
string ::= « STR , native_string »
null ::= « NUL »
symbol ::= « SYM , native_string »
procedure ::= « PRC , size , frame_size , body_vector , environment_vector »
procedure ::= « PRV , size , frame_size , body_vector , environment_vector »
native ::= « NAT , native_function »
pair ::= « PAI , car_expression , cdr_expression »
vector ::= « VEC , expression* »
variable ::= « VLC , offset »
variable ::= « VGL , scope , offset»
application ::= « APL , operator_expression , operand_vector »
begin_form ::= « BEG , begin_vector »
define_form ::= « DFV , offset , define_expression »
define_form ::= « DFF , offset , size , frame_size , body_vector »
define_form ::= « DFZ , offset , size , frame_size , body_vector »
if_form ::= « IFF , predicate_expression , then_expression , else_expression »
if_form ::= « IFZ , predicate_expression , then_expression »
lambda_form ::= « LMB , size , frame_size , body_vector »
lambda_form ::= « LMV , size , frame_size , body_vector »
set_form ::= « SLC , offset , set_expression »
set_form ::= « SGL , scope , offset , set_expression »
SLIP abstract grammar
—— natives ——
2
1
(p) ( ... )
(q r) ( ... )
0
1
1
2
3
4
2
1
3
(s.t) ( ... )
2
1
2
3
4
'(2 3 4)
1
5
1
2
3
3
(begin
(define x 1)
(define y 2)
(define (f p)
(+ p x))
(define (g q r)
(define a 3)
(define b 4)
(define (h s . t)
(define c 5)
(f (+ c (car t))))
(h q r a b))
(g x y))