README.md (3371B)
1 # AWA 5.0 interpreter in C (with debugging utils) 2 Implementation of AWA5.0: 3 - https://github.com/TempTempai/AWA5.0 4 5 currently tested on hello world, fibonacci script, binary->awatalk, and string->awatalk code. Hopefully it works. 6 ### compiling 7 The program only needs libc as a dependency, it's a terminal program. 8 9 So just compile with for example: 10 - unix: `cc main.c -o awaparser` 11 - windows: `cl /Fe: awaparser.exe main.c` 12 13 ### additional opcodes: 14 - syscall 'sys u10' (0x15)\ 15 '~wa awawa awawa **awa awa awa awa awa awa awa awawa**' (syscall 1, write) 16 > The provided u10 is which syscall that will be used\ 17 > The instruction looks at the top most bubble, it must be a double bubble.\ 18 > The double bouble contains the arguments (arg1, arg2, arg3...arg6).\ 19 > The number of arguments depends on the syscall.\ 20 > A double bouble inside a double bouble is interpreted as a raw byte array\ 21 > And a pointer to that raw byte array is provided as the argument.\ 22 > Example: (arg1, (byte1, byte2, byte3, byte4), arg3)\ 23 > The double bubble used as the argument is NOT popped, as return values might be placed in byte arrays (NOT IMPLEMENTED)\ 24 > The return value of the syscall is placed at the top of the stack. 25 - double pop 'p0p' (0x16)\ 26 '~wa awawa awa awa' 27 > Same as pop except double boubles are deleted instead of being released into the bubble abyss 28 ### usage 29 ``` 30 command line options: 31 '--quiet' : disables printing inbetween operations 32 '--step' : steps through the program [press enter] 33 34 '--verbose-parser' : prints opcodes and parameters of the awatalk 35 '--verbose-interpreter' : prints current instruction and stack while executing 36 '--verbose' : enables both of the above 37 '--allow-syscall' : enables syscalls 38 39 '--help' : prints this message 40 41 '-string' : the next provided argument will be awatalk to be parsed 42 '-file' : the next provided argument will be awatalk file to be parsed 43 example usage: 44 awaparser --verbose -string 'awa awa awawa awawa awa awa awa awa awa awawa awa awa awawa awawa awa awa awa awa awa awawawa awa awawa awawa awa awa awa awa awa awawa awa awawa awa awawa awa awa awawawa awa awa awa awawa' 45 awaparser --quiet -file hello_world.awa 46 awaparser --verbose-parser -file hello_world.awa 47 ``` 48 ### debug output example 49 ``` 50 $ ./awaparser --verbose -string 'awa awa awawa awawa awa awa awa awa awa awawa awa awa awawa awawa awa awa awa awa awa awawawa awa awawa awawa awa awa awa awa awa awawa awa awawa awa awawa awa awa awawawa awa awa awa awawa' 51 blo 2 [a] 52 blo 3 [w] 53 blo 2 [a] 54 srn 3 55 prn 56 parsed file succesfully 57 running program: 58 - 59 <<<() | blo 2 [a]>>> 60 <<<(2) | blo 3 [w]>>> 61 <<<(3, 2) | blo 2 [a]>>> 62 <<<(2, 3, 2) | srn 3>>> 63 <<<((2, 3, 2)) | prn>>> 64 awa 65 - 66 program done! 67 ``` 68 69 ### error messages 70 ``` 71 $ ./awaparser --verbose -string 'awa awawawww' 72 0:10 error: awa parser got unexpected input starting here 73 awa awawawww 74 ^~~ 75 ``` 76 ``` 77 $ ./awaparser --verbose -file test.awa 78 blo 0 [A] 79 blo 0 [A] 80 blo 0 [A] 81 blo 0 [A] 82 blo 0 [A] 83 blo 0 [A] 84 blo 0 [A] 85 blo 0 [A] 86 blo 39 [f] 87 prn 88 blo 21 [i] 89 prn 90 blo 41 [r] 91 prn 92 14:32 error: awa parser got unexpected input starting here 93 awa__hello_ebebiben!__ awawa awwa awawa awawa awa awa 94 ^~~ 95 NOTE: awa parser error above happened while parsing an opcode 96 error during parsing, exiting. 97 ```