blang/src/blang.c

25 lines
400 B
C
Raw Normal View History

#include <stdint.h>
2022-12-09 04:45:46 +00:00
#include <stdio.h>
#include <stdlib.h>
2022-12-10 00:26:10 +00:00
#include "blang.h"
#include "ops.h"
2022-12-09 04:45:46 +00:00
2022-12-10 00:26:10 +00:00
int main(int argc, char **argv){
struct State s;
2022-12-09 04:45:46 +00:00
int c;
2022-12-10 00:26:10 +00:00
void (*op)(struct State *);
s.chart = *(argv+1);
s.counter = 0;
2022-12-10 00:26:10 +00:00
for(s.counter = 0; ; ++s.counter){
2022-12-10 00:26:10 +00:00
if(s.chart == (char *)0)
return (int)s.hand;
if((op = Ops_lookup(s.chart[s.counter])) == NULL)
return 127;
2022-12-10 00:26:10 +00:00
else
op(&s);
2022-12-09 04:45:46 +00:00
}
}