open Ast
open Parser

let tokenize = function
| LPAREN -> "LPAREN"
| RPAREN -> "RPAREN"
| LBRACE -> "LBRACE"
| RBRACE -> "RBRACE"
| LBRACK -> "LBRACK"
| RBRACK -> "RBRACK"
| SEMI -> "SEMI"
| COMMA -> "COMMA"
| ASSIGN -> "ASSIGN"
| PLUS -> "PLUS"
| MINUS -> "MINUS"
| TIMES -> "TIMES"
| STARSTAR -> "STARSTAR"
| DIVIDE -> "DIVIDE"
| EQ -> "EQ"
| NEQ -> "NEQ"
| LT -> "LT"
| AMP -> "AMP"
| GT -> "GT"
| PLUSPLUS -> "PLUSPLUS"
| GEQ -> "GEQ"
| LEQ -> "LEQ"
| EXP -> "EXP"
| AND -> "AND"
| OR -> "OR"
| NOT -> "NOT"
| INT -> "INT"
| FLOAT -> "FLOAT"
| BOOL -> "BOOL"
| STRING -> "STRING"
| VOID -> "VOID"
| TRUE -> "TRUE"
| FALSE -> "FALSE"
| IF -> "IF"
| ELSE -> "ELSE"
| FOR -> "FOR"
| WHILE -> "WHILE"
| RETURN -> "RETURN"
| NULL -> "NULL"
| NEW -> "NEW"
| LMATBRACK -> "LMATBRACK"
| RMATBRACK -> "RMATBRACK"
| IMG -> "IMG"
| ARRAY -> "ARRAY"
| MATRIX -> "MATRIX"
| BAR -> "BAR"
| FLOATCAST -> "FLOATCASE"
| DOT -> "DOT"
| FLOATLITERAL(float) -> "FLOATLITERAL"
| INTLITERAL(int) -> "INTLITERAL"
| ID(string) -> "ID"
| STRINGLITERAL(string) -> "STRINGLITERAL"
| EOF -> "EOF"

let _=
        let lexbuf = Lexing.from_channel stdin in
        let rec print_tokens = function
        | EOF -> " "
        | token ->
                        print_endline (tokenize token);
                        print_tokens (Scanner.token lexbuf) in print_tokens (Scanner.token lexbuf)
