diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-08-26 23:16:00 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-08-26 23:16:15 +0200 |
commit | aa049227c17f15ad22092f1fcab4410bbf3521ba (patch) | |
tree | 7046e62ff530746754e19d07d4e8bc7d7a42ea22 /bf.lang | |
parent | b2c5ef755bc7a2c736c5f52c4753dde66c04c3aa (diff) |
Cleanup and features
debugger, bitwise ops, bounds checking, hex literals,
better typing of some optimisations, makefile fix, exit function.
Diffstat (limited to 'bf.lang')
-rw-r--r-- | bf.lang | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -22,7 +22,7 @@ func int[] makejumpmap(char[] src, int srclen) { int stkp := 0; int i := 0; while (i < srclen) { - putint(i); putc(' '); putint(stkp); putc(' '); putc(src[i]); putc('\n'); + // putint(i); putc(' '); putint(stkp); putc(' '); putc(src[i]); putc('\n'); if (src[i] == '[') { stack[stkp] = i; stkp = stkp + 1; @@ -35,6 +35,9 @@ func int[] makejumpmap(char[] src, int srclen) { } i = i + 1; } + if (stkp != 0) { + exit(1); + } /*i = 0; while (i < srclen) { putint(jm[i]); @@ -72,17 +75,20 @@ func interpret(char[] src, int srclen) { ip = ip + 1; } + // debugger; + + putc('\n'); memp = 0; while (memp < 10) { - putint(int(mem[memp])); putc(' '); + putint(int(mem[memp]) & 0xff); putc(' '); memp = memp + 1; } putc('\n'); } func int main() { - int bufsize := 4088; - char[] source := new char[4088]; + int bufsize := 12280; + char[] source := new char[12280]; int sourcelen := 0; while (1) { |