Mercurial > repos > tabletprog
annotate samples/int64.tp @ 251:2557ce4e671f
Fix a couple of compiler bugs. topenv was getting initialized in multiple places. This resulted in multiple copies of modules getting created which caused problems for macro expansion. Additionally, arguments were not being marked as declared during code generation so assigning to an argument that was not closed over generated invalid C code.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 11 Apr 2014 22:29:32 -0700 |
parents | f98790d8a53d |
children |
rev | line source |
---|---|
135
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #{ |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 main <- { |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 a <- 2147483647 |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 b <- 2147483647i64 |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 print: "a + a = " . (string: a + a) . "\n" |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 print: "b + b = " . (string: b + b) . "\n" |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 print: "hex: a + a = " . (hex: a + a) . "\n" |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 print: "hex: b + b = " . (hex: b + b) . "\n" |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 } |
f98790d8a53d
Add int64, int16 and int8. Also add hex method to integer types.
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 } |