aboutsummaryrefslogtreecommitdiff
path: root/parser.h
blob: 065ed2ac3e1266606e8a0a5568bf0e993ace9b2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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