diff options
| author | Ethan Werner <mail@ethanwerner.com> | 2026-06-09 01:17:41 +0400 |
|---|---|---|
| committer | Ethan Werner <mail@ethanwerner.com> | 2026-06-09 01:17:41 +0400 |
| commit | 96ecf29e8be977f51f351308ef2c7c492bb829aa (patch) | |
| tree | c664aa61262e6f7627a732f0e4fbb84281b99952 /example/pushdown.c | |
| parent | f6a144987cc403de8ad6bddd055f756120f8d405 (diff) | |
refactor
Diffstat (limited to 'example/pushdown.c')
| -rw-r--r-- | example/pushdown.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/example/pushdown.c b/example/pushdown.c index ada8d73..bd34bb8 100644 --- a/example/pushdown.c +++ b/example/pushdown.c @@ -1,13 +1,20 @@ -typedef double pushdown_value_t; +// pushdown.c - Example usage of pushdown.h stack automaton + +#include <stdio.h> + +typedef double stack_value_t; #define STACK_IMPLEMENTATION +#include "../include/stack.h" + +typedef double pushdown_value_t; #define PUSHDOWN_IMPLEMENTATION #include "../include/pushdown.h" int main() { pushdown_instruction_t instructions[] = {PUSH, COPY, MUL, END}; - stack_t input = {}; - stack_t output = {}; + stack_t input = {0}; + stack_t output = {0}; stack_init(&input); stack_init(&output); @@ -19,4 +26,7 @@ int main() { while (output.size) { printf("%lf\n", stack_pop(&output)); } + + stack_free(&input); + stack_free(&output); }
\ No newline at end of file |