school

thing1's amazing school repo
Log | Files | Refs | Submodules | README

torpn.c (384B)


      1 #include <stdio.h>
      2 #include <stdlib.h>
      3 #include <string.h>
      4 
      5 typedef enum op {
      6 	ADD = '+',
      7 	SUB = '-',
      8 	MUL = '*',
      9 	DIV = '/',
     10 } op;
     11 
     12 typedef struct ast {
     13 	op o;
     14 	int val1;
     15 	struct ast *child1;
     16 
     17 	int val2;
     18 	struct ast *child2;
     19 } ast;
     20 
     21 int main(){
     22         FILE *f = fopen("test.in", "r");
     23 	char *expr = malloc(256);
     24 	fgets(expr, 256, f);
     25 
     26 	for (int i = 0; i < strlen(expr); i++){
     27 
     28 	}
     29 }