Mercurial > repos > tabletprog
comparison modules/llcompile.tp @ 357:f237d0cae58b
llcompile now works well enough for the a simple fib program to work
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 16 Apr 2015 08:46:35 -0700 |
parents | 3b023e5a0b42 |
children | 0b83f15e819d |
comparison
equal
deleted
inserted
replaced
356:3b023e5a0b42 | 357:f237d0cae58b |
---|---|
268 asn <- if: idx = ((elseArg expressions) length) - 1 { | 268 asn <- if: idx = ((elseArg expressions) length) - 1 { |
269 dest | 269 dest |
270 } else: { | 270 } else: { |
271 option none | 271 option none |
272 } | 272 } |
273 _compileExpr: expr syms: syms ilfun: ilf dest: (option none) | 273 _compileExpr: expr syms: syms ilfun: ilf dest: asn |
274 } | 274 } |
275 elseblock <- ilf popBlock | 275 elseblock <- ilf popBlock |
276 ilf add: (il skipIf: (il eq) block else: elseblock) | 276 ilf add: (il skipIf: (il eq) block else: elseblock) |
277 dest value: :d { d } none: { _compileError: "Something went wrong" } | 277 dest value: :d { d } none: { _compileError: "Something went wrong" } |
278 } | 278 } |
513 if: (length: args) > 1 { | 513 if: (length: args) > 1 { |
514 text <- (file open: (args get: 1)) readAll | 514 text <- (file open: (args get: 1)) readAll |
515 mcode <- compileText: text | 515 mcode <- compileText: text |
516 _notError: mcode { | 516 _notError: mcode { |
517 ba <- bytearray executableFromBytes: mcode | 517 ba <- bytearray executableFromBytes: mcode |
518 arg <- if: (length: args) > 2 { int32: (args get: 2) } else: {0} | 518 arg <- if: (length: args) > 2 { int64: (args get: 2) } else: {0} |
519 res <- ba runWithArg: (arg int64) | 519 res <- ba runWithArg: (arg int64) |
520 print: (string: res) . "\n" | 520 print: (string: res) . "\n" |
521 } else: :err { | 521 } else: :err { |
522 (file stderr) write: (err msg) . "\n" | 522 (file stderr) write: (err msg) . "\n" |
523 } | 523 } |