mirror of https://github.com/stella-emu/stella.git
Work in progress on expression parser. * and @ dereferences work.
Changed the % prefix for binary input to \ (backslash). It simplifies the lexer/parser syntax *greatly*. Might change back at some point. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@649 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
65e166cf9c
commit
460c7b5254
|
@ -0,0 +1,27 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: ByteDerefExpression.cxx,v 1.1 2005-07-15 01:20:11 urchlay Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Expression.hxx"
|
||||||
|
#include "ByteDerefExpression.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
ByteDerefExpression::ByteDerefExpression(Expression *left)
|
||||||
|
: Expression(left, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: ByteDerefExpression.hxx,v 1.1 2005-07-15 01:20:11 urchlay Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef BYTEDEREF_EXPRESSION_HXX
|
||||||
|
#define BYTEDEREF_EXPRESSION_HXX
|
||||||
|
|
||||||
|
#include "Debugger.hxx"
|
||||||
|
#include "Expression.hxx"
|
||||||
|
|
||||||
|
/**
|
||||||
|
@author B. Watson
|
||||||
|
@version $Id: ByteDerefExpression.hxx,v 1.1 2005-07-15 01:20:11 urchlay Exp $
|
||||||
|
*/
|
||||||
|
class ByteDerefExpression : public Expression
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ByteDerefExpression(Expression *left);
|
||||||
|
int evaluate() { return Debugger::debugger().peek(myLHS->evaluate()); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Debugger.hxx,v 1.51 2005-07-14 15:13:14 stephena Exp $
|
// $Id: Debugger.hxx,v 1.52 2005-07-15 01:20:11 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -52,7 +52,7 @@ enum {
|
||||||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@author Stephen Anthony
|
||||||
@version $Id: Debugger.hxx,v 1.51 2005-07-14 15:13:14 stephena Exp $
|
@version $Id: Debugger.hxx,v 1.52 2005-07-15 01:20:11 urchlay Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -216,6 +216,10 @@ class Debugger : public DialogContainer
|
||||||
*/
|
*/
|
||||||
static Debugger& debugger() { return *myStaticDebugger; }
|
static Debugger& debugger() { return *myStaticDebugger; }
|
||||||
|
|
||||||
|
/* these are now exposed so Expressions can use them. */
|
||||||
|
int peek(int addr);
|
||||||
|
int dpeek(int addr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
Save state of each debugger subsystem
|
Save state of each debugger subsystem
|
||||||
|
@ -267,9 +271,6 @@ class Debugger : public DialogContainer
|
||||||
// set a bunch of RAM locations at once
|
// set a bunch of RAM locations at once
|
||||||
const string setRAM(IntArray& args);
|
const string setRAM(IntArray& args);
|
||||||
|
|
||||||
int peek(int addr);
|
|
||||||
int dpeek(int addr);
|
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
void autoLoadSymbols(string file);
|
void autoLoadSymbols(string file);
|
||||||
void clearAllBreakPoints();
|
void clearAllBreakPoints();
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: DebuggerParser.cxx,v 1.56 2005-07-14 15:13:58 urchlay Exp $
|
// $Id: DebuggerParser.cxx,v 1.57 2005-07-15 01:20:11 urchlay Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
@ -892,14 +892,21 @@ string DebuggerParser::run(const string& command) {
|
||||||
int status = YaccParser::parse(command.c_str() + 5);
|
int status = YaccParser::parse(command.c_str() + 5);
|
||||||
commandResult += debugger->valueToString(status);
|
commandResult += debugger->valueToString(status);
|
||||||
commandResult += ", result==";
|
commandResult += ", result==";
|
||||||
lastExpression = YaccParser::getResult();
|
if(status == 0) {
|
||||||
commandResult += debugger->valueToString(lastExpression->evaluate());
|
lastExpression = YaccParser::getResult();
|
||||||
|
commandResult += debugger->valueToString(lastExpression->evaluate());
|
||||||
|
} else {
|
||||||
|
delete lastExpression;
|
||||||
|
commandResult += "ERROR";
|
||||||
|
}
|
||||||
return commandResult;
|
return commandResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(command == "expr") {
|
if(command == "expr") {
|
||||||
if(lastExpression)
|
if(lastExpression)
|
||||||
commandResult = "result==" + debugger->valueToString(lastExpression->evaluate());
|
commandResult = "result==" + debugger->valueToString(lastExpression->evaluate());
|
||||||
|
else
|
||||||
|
commandResult = "no valid expr";
|
||||||
return commandResult;
|
return commandResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: WordDerefExpression.cxx,v 1.1 2005-07-15 01:20:11 urchlay Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Expression.hxx"
|
||||||
|
#include "WordDerefExpression.hxx"
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
WordDerefExpression::WordDerefExpression(Expression *left)
|
||||||
|
: Expression(left, 0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
|
||||||
|
//
|
||||||
|
// See the file "license" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id: WordDerefExpression.hxx,v 1.1 2005-07-15 01:20:11 urchlay Exp $
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef WORDDEREF_EXPRESSION_HXX
|
||||||
|
#define WORDDEREF_EXPRESSION_HXX
|
||||||
|
|
||||||
|
#include "Debugger.hxx"
|
||||||
|
#include "Expression.hxx"
|
||||||
|
|
||||||
|
/**
|
||||||
|
@author B. Watson
|
||||||
|
@version $Id: WordDerefExpression.hxx,v 1.1 2005-07-15 01:20:11 urchlay Exp $
|
||||||
|
*/
|
||||||
|
class WordDerefExpression : public Expression
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
WordDerefExpression(Expression *left);
|
||||||
|
int evaluate() { return Debugger::debugger().dpeek(myLHS->evaluate()); }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -5,6 +5,8 @@ MODULE_OBJS := \
|
||||||
src/debugger/DebuggerParser.o \
|
src/debugger/DebuggerParser.o \
|
||||||
src/debugger/EquateList.o \
|
src/debugger/EquateList.o \
|
||||||
src/debugger/Expression.o \
|
src/debugger/Expression.o \
|
||||||
|
src/debugger/ByteDerefExpression.o \
|
||||||
|
src/debugger/WordDerefExpression.o \
|
||||||
src/debugger/ConstExpression.o \
|
src/debugger/ConstExpression.o \
|
||||||
src/debugger/EquateExpression.o \
|
src/debugger/EquateExpression.o \
|
||||||
src/debugger/NotEqualsExpression.o \
|
src/debugger/NotEqualsExpression.o \
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
# can use "yacc" instead of "bison -y"
|
# can use "yacc" instead of "bison -y"
|
||||||
|
|
||||||
all: stella.y
|
all: stella.y stella.l
|
||||||
|
flex stella.l
|
||||||
bison -y -d stella.y
|
bison -y -d stella.y
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: YaccParser.cxx,v 1.5 2005-07-14 15:13:58 urchlay Exp $
|
// $Id: YaccParser.cxx,v 1.6 2005-07-15 01:20:11 urchlay Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -31,6 +31,8 @@
|
||||||
#include "BinNotExpression.hxx"
|
#include "BinNotExpression.hxx"
|
||||||
#include "BinOrExpression.hxx"
|
#include "BinOrExpression.hxx"
|
||||||
#include "BinXorExpression.hxx"
|
#include "BinXorExpression.hxx"
|
||||||
|
#include "ByteDerefExpression.hxx"
|
||||||
|
#include "WordDerefExpression.hxx"
|
||||||
#include "ConstExpression.hxx"
|
#include "ConstExpression.hxx"
|
||||||
#include "DivExpression.hxx"
|
#include "DivExpression.hxx"
|
||||||
#include "EqualsExpression.hxx"
|
#include "EqualsExpression.hxx"
|
||||||
|
@ -91,16 +93,82 @@ int parse(const char *in) {
|
||||||
|
|
||||||
/* hand-rolled lexer. Hopefully faster than flex... */
|
/* hand-rolled lexer. Hopefully faster than flex... */
|
||||||
|
|
||||||
#define is_identifier(x) ( (x>='0' && x<='9') || \
|
inline bool is_base_prefix(char x) { return ( (x=='\\' || x=='$' || x=='#') ); }
|
||||||
(x>='a' && x<='z') || \
|
|
||||||
(x>='A' && x<='Z') || \
|
|
||||||
(x=='.' && x<='_') )
|
|
||||||
|
|
||||||
#define is_operator(x) ( (x=='+' || x=='-' || x=='*' || \
|
inline bool is_identifier(char x) {
|
||||||
x=='/' || x=='<' || x=='>' || \
|
return ( (x>='0' && x<='9') ||
|
||||||
x=='|' || x=='&' || x=='^' || \
|
(x>='a' && x<='z') ||
|
||||||
x=='!' || x=='~' || x=='(' || \
|
(x>='A' && x<='Z') ||
|
||||||
x==')' || x=='=' ) )
|
x=='.' || x=='_' );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool is_operator(char x) {
|
||||||
|
return ( (x=='+' || x=='-' || x=='*' ||
|
||||||
|
x=='/' || x=='<' || x=='>' ||
|
||||||
|
x=='|' || x=='&' || x=='^' ||
|
||||||
|
x=='!' || x=='~' || x=='(' ||
|
||||||
|
x==')' || x=='=' || x=='%' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: error checking!
|
||||||
|
int const_to_int(char *c) {
|
||||||
|
// what base is the input in?
|
||||||
|
BaseFormat base = Debugger::debugger().parser()->base();
|
||||||
|
|
||||||
|
switch(*c) {
|
||||||
|
case '\\':
|
||||||
|
base = kBASE_2;
|
||||||
|
c++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '#':
|
||||||
|
base = kBASE_10;
|
||||||
|
c++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '$':
|
||||||
|
base = kBASE_16;
|
||||||
|
c++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // not a base_prefix, use default base
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
|
switch(base) {
|
||||||
|
case kBASE_2:
|
||||||
|
while(*c) {
|
||||||
|
ret *= 2;
|
||||||
|
ret += (*c - '0'); // FIXME: error check!
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
case kBASE_10:
|
||||||
|
while(*c) {
|
||||||
|
ret *= 10;
|
||||||
|
ret += (*c - '0'); // FIXME: error check!
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
case kBASE_16:
|
||||||
|
while(*c) { // FIXME: error check!
|
||||||
|
int dig = (*c - '0');
|
||||||
|
if(dig > 9) dig = tolower(*c) - 'a';
|
||||||
|
ret *= 16;
|
||||||
|
ret += dig;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "INVALID BASE in lexer!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int yylex() {
|
int yylex() {
|
||||||
static char idbuf[255];
|
static char idbuf[255];
|
||||||
|
@ -113,7 +181,7 @@ int yylex() {
|
||||||
yylval.val = 0;
|
yylval.val = 0;
|
||||||
if(isspace(*c)) {
|
if(isspace(*c)) {
|
||||||
c++;
|
c++;
|
||||||
} else if(is_identifier(*c)) {
|
} else if(is_identifier(*c) || is_base_prefix(*c)) {
|
||||||
state = ST_IDENTIFIER;
|
state = ST_IDENTIFIER;
|
||||||
} else if(is_operator(*c)) {
|
} else if(is_operator(*c)) {
|
||||||
state = ST_OPERATOR;
|
state = ST_OPERATOR;
|
||||||
|
@ -126,7 +194,8 @@ int yylex() {
|
||||||
case ST_IDENTIFIER:
|
case ST_IDENTIFIER:
|
||||||
{
|
{
|
||||||
char *bufp = idbuf;
|
char *bufp = idbuf;
|
||||||
while(is_identifier(*c)) {
|
*bufp++ = *c++; // might be a base prefix
|
||||||
|
while(is_identifier(*c)) { // may NOT be base prefixes
|
||||||
*bufp++ = *c++;
|
*bufp++ = *c++;
|
||||||
//fprintf(stderr, "yylval==%d, *c==%c\n", yylval, *c);
|
//fprintf(stderr, "yylval==%d, *c==%c\n", yylval, *c);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +206,7 @@ int yylex() {
|
||||||
yylval.equate = idbuf;
|
yylval.equate = idbuf;
|
||||||
return EQUATE;
|
return EQUATE;
|
||||||
} else {
|
} else {
|
||||||
yylval.val = atoi(idbuf);
|
yylval.val = const_to_int(idbuf);
|
||||||
return NUMBER;
|
return NUMBER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +217,7 @@ int yylex() {
|
||||||
if(isspace(*c)) {
|
if(isspace(*c)) {
|
||||||
state = ST_SPACE;
|
state = ST_SPACE;
|
||||||
return o;
|
return o;
|
||||||
} else if(is_identifier(*c)) {
|
} else if(is_identifier(*c) || is_base_prefix(*c)) {
|
||||||
state = ST_IDENTIFIER;
|
state = ST_IDENTIFIER;
|
||||||
return o;
|
return o;
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,7 +253,7 @@ int yylex() {
|
||||||
yylval.val = 0;
|
yylval.val = 0;
|
||||||
if(isspace(*c)) {
|
if(isspace(*c)) {
|
||||||
state = ST_SPACE;
|
state = ST_SPACE;
|
||||||
} else if(is_identifier(*c)) {
|
} else if(is_identifier(*c) || is_base_prefix(*c)) {
|
||||||
state = ST_IDENTIFIER;
|
state = ST_IDENTIFIER;
|
||||||
} else if(is_operator(*c)) {
|
} else if(is_operator(*c)) {
|
||||||
state = ST_OPERATOR;
|
state = ST_OPERATOR;
|
||||||
|
@ -200,6 +269,7 @@ int yylex() {
|
||||||
return 0; // hit NUL, end of input.
|
return 0; // hit NUL, end of input.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int l;
|
int l;
|
||||||
|
|
|
@ -36,6 +36,7 @@ void yyerror(char *e) {
|
||||||
%left '&'
|
%left '&'
|
||||||
%left SHR SHL
|
%left SHR SHL
|
||||||
%nonassoc '<' '>' GTE LTE NE EQ
|
%nonassoc '<' '>' GTE LTE NE EQ
|
||||||
|
%nonassoc DEREF
|
||||||
%nonassoc UMINUS
|
%nonassoc UMINUS
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,8 +65,10 @@ expression: expression '+' expression { fprintf(stderr, " +"); $$ = new PlusExpr
|
||||||
| '-' expression %prec UMINUS { fprintf(stderr, " U-"); $$ = new UnaryMinusExpression($2); }
|
| '-' expression %prec UMINUS { fprintf(stderr, " U-"); $$ = new UnaryMinusExpression($2); }
|
||||||
| '~' expression %prec UMINUS { fprintf(stderr, " ~"); $$ = new BinNotExpression($2); }
|
| '~' expression %prec UMINUS { fprintf(stderr, " ~"); $$ = new BinNotExpression($2); }
|
||||||
| '!' expression %prec UMINUS { fprintf(stderr, " !"); $$ = new LogNotExpression($2); }
|
| '!' expression %prec UMINUS { fprintf(stderr, " !"); $$ = new LogNotExpression($2); }
|
||||||
| '<' expression { fprintf(stderr, " <"); /* $$ = new LoByteExpression($2); */ }
|
| '*' expression %prec DEREF { fprintf(stderr, " U*"); $$ = new ByteDerefExpression($2); }
|
||||||
| '>' expression { fprintf(stderr, " >"); /* $$ = new HiByteExpression($2); */ }
|
| '@' expression %prec DEREF { fprintf(stderr, " U@"); $$ = new WordDerefExpression($2); }
|
||||||
|
| '<' expression { fprintf(stderr, " U<"); /* $$ = new LoByteExpression($2); */ }
|
||||||
|
| '>' expression { fprintf(stderr, " U>"); /* $$ = new HiByteExpression($2); */ }
|
||||||
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; }
|
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; }
|
||||||
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); }
|
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); }
|
||||||
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); }
|
| EQUATE { fprintf(stderr, " %s", $1); $$ = new EquateExpression($1); }
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
# define LTE 265
|
# define LTE 265
|
||||||
# define NE 266
|
# define NE 266
|
||||||
# define EQ 267
|
# define EQ 267
|
||||||
# define UMINUS 268
|
# define DEREF 268
|
||||||
|
# define UMINUS 269
|
||||||
|
|
||||||
#line 1 "stella.y"
|
#line 1 "stella.y"
|
||||||
|
|
||||||
|
@ -47,12 +48,12 @@ typedef union {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define YYFINAL 55
|
#define YYFINAL 59
|
||||||
#define YYFLAG -32768
|
#define YYFLAG -32768
|
||||||
#define YYNTBASE 29
|
#define YYNTBASE 31
|
||||||
|
|
||||||
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
||||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 268 ? yytranslate[x] : 31)
|
#define YYTRANSLATE(x) ((unsigned)(x) <= 269 ? yytranslate[x] : 33)
|
||||||
|
|
||||||
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
||||||
static const char yytranslate[] =
|
static const char yytranslate[] =
|
||||||
|
@ -60,16 +61,16 @@ static const char yytranslate[] =
|
||||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 26, 2, 2, 2, 9, 15, 2,
|
2, 2, 2, 27, 2, 2, 2, 9, 15, 2,
|
||||||
27, 28, 7, 6, 2, 5, 2, 8, 2, 2,
|
29, 30, 7, 6, 2, 5, 2, 8, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
18, 2, 19, 2, 2, 2, 2, 2, 2, 2,
|
18, 2, 19, 2, 28, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 14, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 14, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 13, 2, 25, 2, 2, 2,
|
2, 2, 2, 2, 13, 2, 26, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
@ -83,7 +84,7 @@ static const char yytranslate[] =
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
2, 2, 2, 2, 2, 2, 1, 3, 4, 10,
|
2, 2, 2, 2, 2, 2, 1, 3, 4, 10,
|
||||||
11, 12, 16, 17, 20, 21, 22, 23, 24
|
11, 12, 16, 17, 20, 21, 22, 23, 24, 25
|
||||||
};
|
};
|
||||||
|
|
||||||
#if YYDEBUG
|
#if YYDEBUG
|
||||||
|
@ -91,20 +92,21 @@ static const short yyprhs[] =
|
||||||
{
|
{
|
||||||
0, 0, 2, 6, 10, 14, 18, 22, 26, 30,
|
0, 0, 2, 6, 10, 14, 18, 22, 26, 30,
|
||||||
34, 38, 42, 46, 50, 54, 58, 62, 66, 70,
|
34, 38, 42, 46, 50, 54, 58, 62, 66, 70,
|
||||||
74, 77, 80, 83, 86, 89, 93, 95
|
74, 77, 80, 83, 86, 89, 92, 95, 99, 101
|
||||||
};
|
};
|
||||||
static const short yyrhs[] =
|
static const short yyrhs[] =
|
||||||
{
|
{
|
||||||
30, 0, 30, 6, 30, 0, 30, 5, 30, 0,
|
32, 0, 32, 6, 32, 0, 32, 5, 32, 0,
|
||||||
30, 7, 30, 0, 30, 8, 30, 0, 30, 9,
|
32, 7, 32, 0, 32, 8, 32, 0, 32, 9,
|
||||||
30, 0, 30, 15, 30, 0, 30, 13, 30, 0,
|
32, 0, 32, 15, 32, 0, 32, 13, 32, 0,
|
||||||
30, 14, 30, 0, 30, 18, 30, 0, 30, 19,
|
32, 14, 32, 0, 32, 18, 32, 0, 32, 19,
|
||||||
30, 0, 30, 20, 30, 0, 30, 21, 30, 0,
|
32, 0, 32, 20, 32, 0, 32, 21, 32, 0,
|
||||||
30, 22, 30, 0, 30, 23, 30, 0, 30, 16,
|
32, 22, 32, 0, 32, 23, 32, 0, 32, 16,
|
||||||
30, 0, 30, 17, 30, 0, 30, 10, 30, 0,
|
32, 0, 32, 17, 32, 0, 32, 10, 32, 0,
|
||||||
30, 11, 30, 0, 5, 30, 0, 25, 30, 0,
|
32, 11, 32, 0, 5, 32, 0, 26, 32, 0,
|
||||||
26, 30, 0, 18, 30, 0, 19, 30, 0, 27,
|
27, 32, 0, 7, 32, 0, 28, 32, 0, 18,
|
||||||
30, 28, 0, 3, 0, 4, 0
|
32, 0, 19, 32, 0, 29, 32, 30, 0, 3,
|
||||||
|
0, 4, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -113,9 +115,9 @@ static const short yyrhs[] =
|
||||||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||||
static const short yyrline[] =
|
static const short yyrline[] =
|
||||||
{
|
{
|
||||||
0, 43, 46, 47, 48, 49, 50, 51, 52, 53,
|
0, 44, 47, 48, 49, 50, 51, 52, 53, 54,
|
||||||
54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
|
||||||
64, 65, 66, 67, 68, 69, 70, 71
|
65, 66, 67, 68, 69, 70, 71, 72, 73, 74
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -127,17 +129,17 @@ static const char *const yytname[] =
|
||||||
{
|
{
|
||||||
"$", "error", "$undefined.", "NUMBER", "EQUATE", "'-'", "'+'", "'*'",
|
"$", "error", "$undefined.", "NUMBER", "EQUATE", "'-'", "'+'", "'*'",
|
||||||
"'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'",
|
"'/'", "'%'", "LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'",
|
||||||
"SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ", "UMINUS", "'~'",
|
"SHR", "SHL", "'<'", "'>'", "GTE", "LTE", "NE", "EQ", "DEREF", "UMINUS",
|
||||||
"'!'", "'('", "')'", "statement", "expression", 0
|
"'~'", "'!'", "'@'", "'('", "')'", "statement", "expression", 0
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||||
static const short yyr1[] =
|
static const short yyr1[] =
|
||||||
{
|
{
|
||||||
0, 29, 30, 30, 30, 30, 30, 30, 30, 30,
|
0, 31, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||||
30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||||
30, 30, 30, 30, 30, 30, 30, 30
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||||
|
@ -145,7 +147,7 @@ static const short yyr2[] =
|
||||||
{
|
{
|
||||||
0, 1, 3, 3, 3, 3, 3, 3, 3, 3,
|
0, 1, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||||
2, 2, 2, 2, 2, 3, 1, 1
|
2, 2, 2, 2, 2, 2, 2, 3, 1, 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||||
|
@ -153,27 +155,27 @@ static const short yyr2[] =
|
||||||
error. */
|
error. */
|
||||||
static const short yydefact[] =
|
static const short yydefact[] =
|
||||||
{
|
{
|
||||||
0, 26, 27, 0, 0, 0, 0, 0, 0, 1,
|
0, 28, 29, 0, 0, 0, 0, 0, 0, 0,
|
||||||
20, 23, 24, 21, 22, 0, 0, 0, 0, 0,
|
0, 1, 20, 23, 25, 26, 21, 22, 24, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 25, 3, 2, 4, 5, 6,
|
0, 0, 0, 0, 0, 0, 0, 0, 27, 3,
|
||||||
18, 19, 8, 9, 7, 16, 17, 10, 11, 12,
|
2, 4, 5, 6, 18, 19, 8, 9, 7, 16,
|
||||||
13, 14, 15, 0, 0, 0
|
17, 10, 11, 12, 13, 14, 15, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yydefgoto[] =
|
static const short yydefgoto[] =
|
||||||
{
|
{
|
||||||
53, 9
|
57, 11
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yypact[] =
|
static const short yypact[] =
|
||||||
{
|
{
|
||||||
28,-32768,-32768, 28, 28, 28, 28, 28, 28, 75,
|
32,-32768,-32768, 32, 32, 32, 32, 32, 32, 32,
|
||||||
-32768, -12, -12,-32768,-32768, 51, 28, 28, 28, 28,
|
32, 83,-32768,-32768, 34, 34,-32768,-32768,-32768, 57,
|
||||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
|
||||||
28, 28, 28, 28,-32768, 92, 92, 106, 106, 106,
|
32, 32, 32, 32, 32, 32, 32, 32,-32768, 100,
|
||||||
119, 21, 128, 128, 136, 142, 142, -12, -12, -12,
|
100, 114, 114, 114, 127, 138, -7, -7, 24, 63,
|
||||||
-12, -12, -12, 12, 45,-32768
|
63, 34, 34, 34, 34, 34, 34, 38, 48,-32768
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yypgoto[] =
|
static const short yypgoto[] =
|
||||||
|
@ -182,49 +184,49 @@ static const short yypgoto[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define YYLAST 165
|
#define YYLAST 161
|
||||||
|
|
||||||
|
|
||||||
static const short yytable[] =
|
static const short yytable[] =
|
||||||
{
|
{
|
||||||
10, 11, 12, 13, 14, 15,-32768,-32768,-32768,-32768,
|
12, 13, 14, 15, 16, 17, 18, 19, 29, 30,
|
||||||
-32768,-32768, 54, 35, 36, 37, 38, 39, 40, 41,
|
31, 32, 33, 34, 35, 36, 37, 39, 40, 41,
|
||||||
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
|
||||||
52, 1, 2, 3, 23, 24, 25, 26, 27, 28,
|
52, 53, 54, 55, 56, 1, 2, 3, 58, 4,
|
||||||
29, 30, 31, 32, 33, 55, 4, 5, 0, 0,
|
30, 31, 32, 33, 34, 35, 36, 37, 59, 0,
|
||||||
0, 0, 0, 6, 7, 8, 16, 17, 18, 19,
|
5, 6,-32768,-32768,-32768,-32768,-32768,-32768, 7, 8,
|
||||||
20, 21, 22, 0, 23, 24, 25, 26, 27, 28,
|
9, 10, 20, 21, 22, 23, 24, 25, 26, 0,
|
||||||
29, 30, 31, 32, 33, 0, 0, 0, 0, 34,
|
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||||
16, 17, 18, 19, 20, 21, 22, 0, 23, 24,
|
37, 32, 33, 34, 35, 36, 37, 38, 20, 21,
|
||||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 18,
|
22, 23, 24, 25, 26, 0, 27, 28, 29, 30,
|
||||||
19, 20, 21, 22, 0, 23, 24, 25, 26, 27,
|
31, 32, 33, 34, 35, 36, 37, 22, 23, 24,
|
||||||
28, 29, 30, 31, 32, 33, 21, 22, 0, 23,
|
25, 26, 0, 27, 28, 29, 30, 31, 32, 33,
|
||||||
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
|
34, 35, 36, 37, 25, 26, 0, 27, 28, 29,
|
||||||
22, 0, 23, 24, 25, 26, 27, 28, 29, 30,
|
30, 31, 32, 33, 34, 35, 36, 37, 26, 0,
|
||||||
31, 32, 33, 25, 26, 27, 28, 29, 30, 31,
|
27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
|
||||||
32, 33, 26, 27, 28, 29, 30, 31, 32, 33,
|
37, 27, 28, 29, 30, 31, 32, 33, 34, 35,
|
||||||
28, 29, 30, 31, 32, 33
|
36, 37
|
||||||
};
|
};
|
||||||
|
|
||||||
static const short yycheck[] =
|
static const short yycheck[] =
|
||||||
{
|
{
|
||||||
3, 4, 5, 6, 7, 8, 18, 19, 20, 21,
|
3, 4, 5, 6, 7, 8, 9, 10, 15, 16,
|
||||||
22, 23, 0, 16, 17, 18, 19, 20, 21, 22,
|
17, 18, 19, 20, 21, 22, 23, 20, 21, 22,
|
||||||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||||
33, 3, 4, 5, 13, 14, 15, 16, 17, 18,
|
33, 34, 35, 36, 37, 3, 4, 5, 0, 7,
|
||||||
19, 20, 21, 22, 23, 0, 18, 19, -1, -1,
|
16, 17, 18, 19, 20, 21, 22, 23, 0, -1,
|
||||||
-1, -1, -1, 25, 26, 27, 5, 6, 7, 8,
|
18, 19, 18, 19, 20, 21, 22, 23, 26, 27,
|
||||||
9, 10, 11, -1, 13, 14, 15, 16, 17, 18,
|
28, 29, 5, 6, 7, 8, 9, 10, 11, -1,
|
||||||
19, 20, 21, 22, 23, -1, -1, -1, -1, 28,
|
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||||||
5, 6, 7, 8, 9, 10, 11, -1, 13, 14,
|
23, 18, 19, 20, 21, 22, 23, 30, 5, 6,
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 7,
|
7, 8, 9, 10, 11, -1, 13, 14, 15, 16,
|
||||||
8, 9, 10, 11, -1, 13, 14, 15, 16, 17,
|
17, 18, 19, 20, 21, 22, 23, 7, 8, 9,
|
||||||
18, 19, 20, 21, 22, 23, 10, 11, -1, 13,
|
10, 11, -1, 13, 14, 15, 16, 17, 18, 19,
|
||||||
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
20, 21, 22, 23, 10, 11, -1, 13, 14, 15,
|
||||||
11, -1, 13, 14, 15, 16, 17, 18, 19, 20,
|
16, 17, 18, 19, 20, 21, 22, 23, 11, -1,
|
||||||
21, 22, 23, 15, 16, 17, 18, 19, 20, 21,
|
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||||||
22, 23, 16, 17, 18, 19, 20, 21, 22, 23,
|
23, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||||
18, 19, 20, 21, 22, 23
|
22, 23
|
||||||
};
|
};
|
||||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||||
#line 3 "/usr/share/bison/bison.simple"
|
#line 3 "/usr/share/bison/bison.simple"
|
||||||
|
@ -934,111 +936,119 @@ yyreduce:
|
||||||
switch (yyn) {
|
switch (yyn) {
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
#line 43 "stella.y"
|
#line 44 "stella.y"
|
||||||
{ fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; }
|
{ fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; }
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
#line 46 "stella.y"
|
#line 47 "stella.y"
|
||||||
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
#line 47 "stella.y"
|
#line 48 "stella.y"
|
||||||
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
#line 48 "stella.y"
|
#line 49 "stella.y"
|
||||||
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
#line 49 "stella.y"
|
#line 50 "stella.y"
|
||||||
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
#line 50 "stella.y"
|
#line 51 "stella.y"
|
||||||
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
#line 51 "stella.y"
|
#line 52 "stella.y"
|
||||||
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
#line 52 "stella.y"
|
#line 53 "stella.y"
|
||||||
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
#line 53 "stella.y"
|
#line 54 "stella.y"
|
||||||
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
#line 54 "stella.y"
|
#line 55 "stella.y"
|
||||||
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
#line 55 "stella.y"
|
#line 56 "stella.y"
|
||||||
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
#line 56 "stella.y"
|
#line 57 "stella.y"
|
||||||
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
#line 57 "stella.y"
|
#line 58 "stella.y"
|
||||||
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
#line 58 "stella.y"
|
#line 59 "stella.y"
|
||||||
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
#line 59 "stella.y"
|
#line 60 "stella.y"
|
||||||
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
#line 60 "stella.y"
|
#line 61 "stella.y"
|
||||||
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 17:
|
case 17:
|
||||||
#line 61 "stella.y"
|
#line 62 "stella.y"
|
||||||
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
#line 62 "stella.y"
|
#line 63 "stella.y"
|
||||||
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
#line 63 "stella.y"
|
#line 64 "stella.y"
|
||||||
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
#line 64 "stella.y"
|
#line 65 "stella.y"
|
||||||
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); }
|
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 21:
|
case 21:
|
||||||
#line 65 "stella.y"
|
#line 66 "stella.y"
|
||||||
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); }
|
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
#line 66 "stella.y"
|
#line 67 "stella.y"
|
||||||
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); }
|
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 23:
|
case 23:
|
||||||
#line 67 "stella.y"
|
#line 68 "stella.y"
|
||||||
{ fprintf(stderr, " <"); /* $$ = new LoByteExpression($2); */ }
|
{ fprintf(stderr, " U*"); yyval.exp = new ByteDerefExpression(yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
#line 68 "stella.y"
|
#line 69 "stella.y"
|
||||||
{ fprintf(stderr, " >"); /* $$ = new HiByteExpression($2); */ }
|
{ fprintf(stderr, " U@"); yyval.exp = new WordDerefExpression(yyvsp[0].exp); }
|
||||||
break;
|
break;
|
||||||
case 25:
|
case 25:
|
||||||
#line 69 "stella.y"
|
#line 70 "stella.y"
|
||||||
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; }
|
{ fprintf(stderr, " U<"); /* $$ = new LoByteExpression($2); */ }
|
||||||
break;
|
break;
|
||||||
case 26:
|
case 26:
|
||||||
#line 70 "stella.y"
|
#line 71 "stella.y"
|
||||||
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); }
|
{ fprintf(stderr, " U>"); /* $$ = new HiByteExpression($2); */ }
|
||||||
break;
|
break;
|
||||||
case 27:
|
case 27:
|
||||||
#line 71 "stella.y"
|
#line 72 "stella.y"
|
||||||
|
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; }
|
||||||
|
break;
|
||||||
|
case 28:
|
||||||
|
#line 73 "stella.y"
|
||||||
|
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); }
|
||||||
|
break;
|
||||||
|
case 29:
|
||||||
|
#line 74 "stella.y"
|
||||||
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); }
|
{ fprintf(stderr, " %s", yyvsp[0].equate); yyval.exp = new EquateExpression(yyvsp[0].equate); }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1274,5 +1284,5 @@ yyreturn:
|
||||||
#endif
|
#endif
|
||||||
return yyresult;
|
return yyresult;
|
||||||
}
|
}
|
||||||
#line 73 "stella.y"
|
#line 76 "stella.y"
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ typedef union {
|
||||||
# define LTE 265
|
# define LTE 265
|
||||||
# define NE 266
|
# define NE 266
|
||||||
# define EQ 267
|
# define EQ 267
|
||||||
# define UMINUS 268
|
# define DEREF 268
|
||||||
|
# define UMINUS 269
|
||||||
|
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
Loading…
Reference in New Issue