-//===-- llvmAsmParser.y - Parser for llvm assembly files --------*- C++ -*-===//
+//===-- StackerParser.y - Parser for Stacker programs -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
//
//===----------------------------------------------------------------------===//
//
-// This file implements the bison parser for LLVM assembly languages files.
+// This file implements the bison parser for Stacker programs.
//
//===----------------------------------------------------------------------===//
-%debug
-
%{
#include "StackerCompiler.h"
#include "llvm/SymbolTable.h"
#include "llvm/Module.h"
-#include "llvm/iTerminators.h"
-#include "llvm/iMemory.h"
-#include "llvm/iOperators.h"
-#include "llvm/iPHINode.h"
-#include "Support/STLExtras.h"
-#include "Support/DepthFirstIterator.h"
+#include "llvm/Instructions.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/DepthFirstIterator.h"
#include <list>
#include <utility>
#include <algorithm>
llvm::Module* ModuleVal;
llvm::Function* FunctionVal;
llvm::BasicBlock* BasicBlockVal;
- uint32_t IntegerVal;
+ int64_t IntegerVal;
char* StringVal;
}
/* Terminal Tokens */
%token SEMI COLON FORWARD MAIN DUMP
-%token TRUE FALSE LESS MORE LESS_EQUAL MORE_EQUAL NOT_EQUAL EQUAL
+%token TRUETOK FALSETOK LESS MORE LESS_EQUAL MORE_EQUAL NOT_EQUAL EQUAL
%token PLUS MINUS INCR DECR MULT DIV MODULUS NEGATE ABS MIN MAX STAR_SLASH
%token AND OR XOR LSHIFT RSHIFT
%token DROP DROP2 NIP NIP2 DUP DUP2 SWAP SWAP2 OVER OVER2 ROT ROT2
/* A WordList is just a sequence of words */
WordList : WordList Word { $$ = SCI->handle_word_list_end( $1, $2 ); }
- | /* empty */ { $$ = SCI->handle_word_list_start() } ;
+ | /* empty */ { $$ = SCI->handle_word_list_start(); } ;
/* A few "words" have a funky syntax */
/* FIXME: The body of compound words can currently only be function calls */
Word : INTEGER { $$ = SCI->handle_integer( $1 ); } ;
/* Everything else is a terminal symbol and goes to handle_word */
-Word : TRUE { $$ = SCI->handle_word( TRUE ); } ;
-Word : FALSE { $$ = SCI->handle_word( FALSE ); } ;
+Word : TRUETOK { $$ = SCI->handle_word( TRUETOK ); } ;
+Word : FALSETOK { $$ = SCI->handle_word( FALSETOK ); } ;
Word : LESS { $$ = SCI->handle_word( LESS ); } ;
Word : MORE { $$ = SCI->handle_word( MORE ); } ;
Word : LESS_EQUAL { $$ = SCI->handle_word( LESS_EQUAL ); } ;