Mercurial > repos > tabletprog
annotate modules/compiler.tp @ 280:23b52d2d05a0
Don't try to replace self in a macro expansion since it's unlikely to be the desired behavior. A more explicit means of specifying what variables should be replaced in a quote expression is needed.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 21 Jul 2014 19:30:23 -0700 |
parents | 004946743678 |
children |
rev | line source |
---|---|
252
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #{ |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 main <- :args { |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 if: (args length) > 1 { |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 file <- os open: (args get: 1) (os O_RDONLY) |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 code <- "" |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 chunksize <- 1024 |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 readsize <- chunksize |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 while: { readsize = chunksize} do: { |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 seg <- os read: file chunksize |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 code <- code . seg |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 readsize <- seg byte_length |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 } |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 res <- parser top: code |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 if: res { |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 methods <- symbols buildMethodTable: (res yield) |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 print: methods |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 } else: { |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 print: "Parse failed!\n" |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 } |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 } else: { |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 print: "Usage compiler FILE\n" |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 } |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 } |
004946743678
Added code for building a method symbol table
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 } |