From d45a5b21de22438c004e1db96a8f154da09cdc0e Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Wed, 14 May 2014 22:27:34 +0300 Subject: Initial commit - tokenizing, parsing and basic eval support - arithmetic (+, -, *, /) - quote - atom for checking if the arg is an atom (i.e. not a list) - eq for checking equality - > for checking order - if - some unit testing - simple repl - mem management needs improvement :-) --- tokens.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tokens.h (limited to 'tokens.h') diff --git a/tokens.h b/tokens.h new file mode 100644 index 0000000..8b06454 --- /dev/null +++ b/tokens.h @@ -0,0 +1,24 @@ +#ifndef TOKENS_H +#define TOKENS_H + +enum +{ + TOKEN_INT, + TOKEN_STR, + TOKEN_SYMBOL, + TOKEN_LPAREN, + TOKEN_RPAREN, + TOKEN_PERIOD, + TOKEN_QUOTE +}; + +struct token +{ + const char *s; + int len; + int type; +}; + +int get_next_token(const char *src, int *pos, struct token *token); + +#endif -- cgit v1.2.3