diff options
author | thing 1 <thing1@seacrossedlovers.xyz> | 2025-01-10 17:38:56 +0000 |
---|---|---|
committer | thing 1 <thing1@seacrossedlovers.xyz> | 2025-01-10 17:38:56 +0000 |
commit | e46e08fceff29622399855043554635d6e33c3c4 (patch) | |
tree | b8074819364bd54b54b4798f07002fe234c506ac /lucky.c |
init commit
Diffstat (limited to 'lucky.c')
-rw-r--r-- | lucky.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,32 @@ +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> +#include <string.h> +#include "parser.h" +#include "eval.h" + +void strip(char *s, char c){ + for (int i = 0; i < strlen(s); i++){ + if (s[i] == c) { + s[i] = 0; + return; + } + } + return; + +} + +int main(int argc, char **argv){ + FILE *f = fopen(argv[1], "r"); + char *line = malloc(256); + while (fgets(line, 256, f) != NULL){ + strip(line, '\n'); + if (strlen(line) == 0) goto skip; + + luckytree *tree = parse(line); + luckyval *ret = eval(tree); + free(tree); + free(ret); +skip: + } +} |