jack-compiler/tokenizer/tokenizer.h

22 lines
374 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-29 19:27:48 -05:00
TOKEN* tokenize(char* filename);
2021-01-03 14:08:54 -05:00
void freetokens(TOKEN* t);
2020-11-30 16:44:22 -05:00
#endif