AST function/constructor - CALL output

26 views
Skip to first unread message

Matt Snider

unread,
Nov 29, 2012, 1:47:22 AM11/29/12
to uoft_csc...@googlegroups.com
Hi 

From the Lab 3 spec: 

(CALL name ...), where name is the name of a function (in the case of a function
call) or type (in the cast of a constructor call) and ... are one or more expression
forms representing the arguments, respectively.

My question is how exactly arguments should be outputted when printing the AST. 

e.g.
int x, y;
dp3
(x, y) -> (CALL dp3 x y)

int d, e, f;
ivec3
(d, e, 1) -> (CALL d e 1)

float a, b;
bvec4
(a == 2.01, d >= 3, !e, a || b) ->
(CALL bvec4 (BINARY float == a 2.01) (BINARY int >= d 3) (UNARY int ! e) (BINARY float || a b))



Are these correct? Is literally just a whitespace- separated list of expressions? 



Peter Goodman

unread,
Nov 29, 2012, 10:21:38 AM11/29/12
to uoft_csc...@googlegroups.com
Close. Yes, just a whitespace-seaprated list of expressions. Make sure you use the result type in the BINARY/UNARY things, and not one of the operand types.

(CALL dp3 x y)
(CALL ivec3 d e 1)
(CALL bvec4 (BINARY bool == a 2.01) (BINARY bool >= d 3) (UNARY bool ! e) (BINARY bool || a b))

Best Regards,

Peter Goodman,
http://www.petergoodman.me
65 High Park Ave.,
Toronto, Ontario
M6P 2R7





--
 
 

Matt Snider

unread,
Nov 29, 2012, 9:47:57 PM11/29/12
to uoft_csc...@googlegroups.com
Oh, woops! Thanks.
Reply all
Reply to author
Forward
0 new messages