// pushdown.c - Example usage of pushdown.h stack automaton #include 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 = {0}; stack_t output = {0}; stack_init(&input); stack_init(&output); stack_push(&input, 4.0); pushdown_run(&output, &input, instructions); while (output.size) { printf("%lf\n", stack_pop(&output)); } stack_free(&input); stack_free(&output); }