comparison modules/compiler.tp @ 252:004946743678

Added code for building a method symbol table
author Michael Pavone <pavone@retrodev.com>
date Sat, 10 May 2014 19:11:01 -0700
parents
children
comparison
equal deleted inserted replaced
251:2557ce4e671f 252:004946743678
1 #{
2 main <- :args {
3 if: (args length) > 1 {
4 file <- os open: (args get: 1) (os O_RDONLY)
5
6 code <- ""
7 chunksize <- 1024
8 readsize <- chunksize
9 while: { readsize = chunksize} do: {
10 seg <- os read: file chunksize
11 code <- code . seg
12 readsize <- seg byte_length
13 }
14 res <- parser top: code
15 if: res {
16 methods <- symbols buildMethodTable: (res yield)
17 print: methods
18 } else: {
19 print: "Parse failed!\n"
20 }
21 } else: {
22 print: "Usage compiler FILE\n"
23 }
24 }
25 }