annotate samples/private.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 cd41f7c22fcd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
47
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 makeobj <- {
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3 foo <- 40
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #{
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
5 bar <- {
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 foo
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 }
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 inc <- {
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 foo <- foo + 1
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 1
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 }
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 }
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 }
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 main <- {
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 baz <- makeobj:
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 inc: baz
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 inc: baz
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 bar: baz
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 }
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 }
cd41f7c22fcd Remove compiled hello and private samples and add source
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21