diff options
author | Rasmus Luha <rasmus.luha@gmail.com> | 2022-11-03 01:08:28 +0200 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@gmail.com> | 2022-11-03 01:08:28 +0200 |
commit | 4bdad2d5c7dec0eb19c418cadb47cc3124092310 (patch) | |
tree | c80d9cceb8e10e91daf38657cf64d8ce0bbf3104 /inc | |
parent | fcb9ff2b96de6989e9a676e96753b1b1279acf67 (diff) |
Diffstat (limited to 'inc')
-rw-r--r-- | inc/mem.h | 9 | ||||
-rw-r--r-- | inc/stack.h | 15 | ||||
-rw-r--r-- | inc/translator.h | 18 |
3 files changed, 36 insertions, 6 deletions
@@ -9,12 +9,21 @@ struct mem_st { }; int mem_pos(); + int mem_inc(); int mem_dec(); + int mem_left(); int mem_right(); + int mem_get(); int mem_set(char v); + void mem_printDebug(); + +//Added +//int mem_add(int amout); +//int mem_move(int amout); + #endif diff --git a/inc/stack.h b/inc/stack.h index fcc976a..45f8daa 100644 --- a/inc/stack.h +++ b/inc/stack.h @@ -5,13 +5,16 @@ struct stack_st { int len; - int arr[STACK_SIZE]; + int size; + int* arr; }; -void stackPush(int val); -int stackPop(void); -int stackIsEmpty(void); -int stackPeek(void); -void stackPrint(void); +void stackPush(struct stack_st *s, int val); +int stackPop(struct stack_st *s); +int stackIsEmpty(struct stack_st *s); +int stackPeek(struct stack_st *s); +void stackPrint(struct stack_st *s); + +void stackFree(struct stack_st *s); #endif diff --git a/inc/translator.h b/inc/translator.h new file mode 100644 index 0000000..0007526 --- /dev/null +++ b/inc/translator.h @@ -0,0 +1,18 @@ +#ifndef _TRANSLATOR_H__ +#define _TRANSLATOR_H__ + +/* Selle struktuuriga esitame kõiki Brainfuck instruktsioone koos + lisainfoga, mis võimaldavad optimeeringuid. +*/ +struct BF_instruction_st { + + /* Instruktsiooni väljakutse funktsioon. Esimene parameeter on viit instruktsiooni + objektile teine on viit instruktsiooni indeksile, mida antud funktsioon + peab kas suurendama või muutma (näiteks tsüklites). + */ + + void (*run)(struct BF_instruction_st *instruction, int *index); +}; + + +#endif |