diff options
| author | Nakidai <plaza521@inbox.ru> | 2024-08-23 20:43:31 +0300 |
|---|---|---|
| committer | Nakidai <plaza521@inbox.ru> | 2024-08-23 20:43:31 +0300 |
| commit | 2b0e05cbc1e4d9beccd3a5867c8730880f6ecc10 (patch) | |
| tree | f0e5e31e6259e0b6ea940c1d4c394b976a4bac74 /src/instruction.c | |
| parent | 9e4058194742794f7742f19cb1a0bb3451ce22ea (diff) | |
| download | 3cl-2b0e05cbc1e4d9beccd3a5867c8730880f6ecc10.tar.gz 3cl-2b0e05cbc1e4d9beccd3a5867c8730880f6ecc10.zip | |
Start to rewriting code
Since there's some UB in the master I decided to rewrite code from scratch again. I hope that attempt will be better :D
Diffstat (limited to 'src/instruction.c')
| -rw-r--r-- | src/instruction.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/instruction.c b/src/instruction.c new file mode 100644 index 0000000..8597d74 --- /dev/null +++ b/src/instruction.c @@ -0,0 +1,18 @@ +#include "instruction.h" + +#include "3cl.h" + +struct CCLFrame *ccl_instruction(struct CCL *ccl, struct CCLFrame *frame) +{ + CCLInstruction instruction; + switch (ccl->code[frame->ep]) + { + case '\n': /* FALLTHROUGH */ + case ' ' : /* FALLTHROUGH */ + case '\t': instruction = ccl_instruction_nop; + case '^' : instruction = ccl_instruction_pushzero; + case '+' : instruction = ccl_instruction_increment; + case '-' : instruction = ccl_instruction_decrement; + } + return instruction(ccl, frame); +} |