%require "3.8.2" %debug %defines %define api.namespace { DragonLisp } %define api.parser.class { DLParser } %code requires { #include #include "token.h" namespace DragonLisp { class DLDriver; class DLScanner; } } %parse-param { DLScanner& scanner } %param { DLDriver& drv } %code { #include #include #include #include "DragonLispDriver.hh" #undef yylex #define yylex scanner.yylex } %locations %define api.token.prefix {TOKEN_} %define api.value.type variant %define parse.assert %token LESS_EQUAL "<=" GREATER_EQUAL ">=" LESS "<" GREATER ">" NOT_EQUAL "/=" EQUAL "=" LPAREN "(" RPAREN ")" PLUS "+" MINUS "-" MULTIPLY "*" DIVIDE "/" SPACE AND "and" OR "or" NOT "not" MAX "max" MIN "min" IF "if" LOGAND "logand" LOGIOR "logior" LOGXOR "logxor" LOGNOR "lognor" LOGEQV "logeqv" MOD "mod" REM "rem" INCF "incf" DECF "decf" DEFVAR "defvar" DEFUN "defun" PRINT "print" LOOP "loop" SETQ "setq" QUOTE "quote" DEFCONSTANT "defconstant" ; %token END 0 "EOF" %token FLOAT "float" %token INTEGER "integer" %token STRING "string" %token IDENTIFIER "identifier" %define parse.error verbose %% S : END %% void DragonLisp::DLParser::error(const location_type& l, const std::string& msg) { std::cerr << "Error: " << msg << " at " << l << "\n"; }