jack-compiler/tokenizer.h

22 lines
377 B
C
Raw Normal View History

2020-11-30 16:44:22 -05:00
#ifndef TOKENIZER_H
#define TOKENIZER_H
#include <stdio.h>
2020-12-21 16:11:23 -05:00
/* tokenizer
* Simple tool that splits a stream into many tokens. */
2020-11-30 16:44:22 -05:00
typedef enum {
2020-12-14 14:12:20 -05:00
keyword, identifier, symbol, integer, string
2020-11-30 16:44:22 -05:00
} TOKENTYPE;
2020-12-14 14:12:20 -05:00
typedef struct token {
2020-11-30 16:44:22 -05:00
char* token;
TOKENTYPE type;
2020-12-21 16:11:23 -05:00
int definedat;
2020-12-14 14:12:20 -05:00
struct token* next;
} TOKEN;
2020-11-30 16:44:22 -05:00
2020-12-14 14:12:20 -05:00
TOKEN* tokenize(FILE* input);
2020-12-21 16:11:23 -05:00
void freetokenlist(TOKEN* list);
2020-11-30 16:44:22 -05:00
#endif