annotate samples/file.tp @ 354:a6cdcc1b1c02

Fix il and llcompile modules enough that it actually attempts to run the compiled program
author Michael Pavone <pavone@retrodev.com>
date Wed, 15 Apr 2015 20:08:38 -0700
parents abe3141caefe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
297
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #{
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 import: [
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 stdin
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 stdout
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 ] from: file
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 main <- {
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7 stdout write: "Hello from the file module!\nWhat's your name?\n"
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 name <- (stdin nextLine) trim
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 stdout write: "Nice to meet you " . name . ". Here's my source code:\n\n"
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 f <- file open: "samples/file.tp"
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 foreach: (f lines) :num text {
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 print: (string: num+1) . ": " . text
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 }
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 print: "\n"
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 f close
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 0
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 }
abe3141caefe Added file module and sample
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 }