diff options
author | Teddy <ted.sybil@gmail.com> | 2013-08-03 12:10:09 +0800 |
---|---|---|
committer | Teddy <ted.sybil@gmail.com> | 2013-08-03 12:10:09 +0800 |
commit | e462669c3c3cc04ea29420e14dbb589899d201ec (patch) | |
tree | cc217c58388fbf13229bf4a25b639d17458e8fc9 /parser.h | |
parent | af2da07be7d3f8a936640ef92b0692710a22e0d4 (diff) |
AST parser can now work!
Diffstat (limited to 'parser.h')
-rw-r--r-- | parser.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/parser.h b/parser.h new file mode 100644 index 0000000..065ed2a --- /dev/null +++ b/parser.h @@ -0,0 +1,32 @@ +#ifndef PARSER_H +#define PARSER_H + +#include "model.h" +#include <string> + +using std::string; + +const int TOKEN_BUFF_SIZE = 65536; +const int PARSE_STACK_SIZE = 65536; + +class Tokenizor { + private: + FILE *stream; + char *buff_ptr; + public: + Tokenizor(); + void set_stream(FILE *stream); + bool get_token(string &ret); +}; + +class ASTGenerator { + private: + static EvalObj* to_float(const string &); + static EvalObj* to_int(const string &); + static EvalObj* to_obj(const string &); + public: + ASTGenerator(); + Cons *absorb(Tokenizor *tk); +}; + +#endif |