mirror of https://github.com/stella-emu/stella.git
More Expression classes.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@638 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
c91d4af440
commit
7c675fdc36
|
@ -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: BinNotExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "BinNotExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
BinNotExpression::BinNotExpression(Expression *left)
|
||||
: Expression(left, 0)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: BinNotExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef BINNOT_EXPRESSION_HXX
|
||||
#define BINNOT_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: BinNotExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class BinNotExpression : public Expression
|
||||
{
|
||||
public:
|
||||
BinNotExpression(Expression *left);
|
||||
int evaluate() { return ~(myLHS->evaluate()); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: GreaterEqualsExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "GreaterEqualsExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GreaterEqualsExpression::GreaterEqualsExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: GreaterEqualsExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef GREATEREQUALS_EXPRESSION_HXX
|
||||
#define GREATEREQUALS_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: GreaterEqualsExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class GreaterEqualsExpression : public Expression
|
||||
{
|
||||
public:
|
||||
GreaterEqualsExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() >= myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: GreaterExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "GreaterExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GreaterExpression::GreaterExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: GreaterExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef GREATER_EXPRESSION_HXX
|
||||
#define GREATER_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: GreaterExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class GreaterExpression : public Expression
|
||||
{
|
||||
public:
|
||||
GreaterExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() > myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: LessEqualsExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "LessEqualsExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LessEqualsExpression::LessEqualsExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: LessEqualsExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef LESSEQUALS_EXPRESSION_HXX
|
||||
#define LESSEQUALS_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: LessEqualsExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class LessEqualsExpression : public Expression
|
||||
{
|
||||
public:
|
||||
LessEqualsExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() <= myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: LessExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "LessExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LessExpression::LessExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: LessExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef LESS_EXPRESSION_HXX
|
||||
#define LESS_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: LessExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class LessExpression : public Expression
|
||||
{
|
||||
public:
|
||||
LessExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() < myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: LogNotExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "LogNotExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
LogNotExpression::LogNotExpression(Expression *left)
|
||||
: Expression(left, 0)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: LogNotExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef LOGNOT_EXPRESSION_HXX
|
||||
#define LOGNOT_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: LogNotExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class LogNotExpression : public Expression
|
||||
{
|
||||
public:
|
||||
LogNotExpression(Expression *left);
|
||||
int evaluate() { return !(myLHS->evaluate()); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: NotEqualsExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "NotEqualsExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
NotEqualsExpression::NotEqualsExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: NotEqualsExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef NOTEQUALS_EXPRESSION_HXX
|
||||
#define NOTEQUALS_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: NotEqualsExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class NotEqualsExpression : public Expression
|
||||
{
|
||||
public:
|
||||
NotEqualsExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() != myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: ShiftLeftExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "ShiftLeftExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ShiftLeftExpression::ShiftLeftExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: ShiftLeftExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SHIFTLEFT_EXPRESSION_HXX
|
||||
#define SHIFTLEFT_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: ShiftLeftExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class ShiftLeftExpression : public Expression
|
||||
{
|
||||
public:
|
||||
ShiftLeftExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() << myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: ShiftRightExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "ShiftRightExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ShiftRightExpression::ShiftRightExpression(Expression *left, Expression *right)
|
||||
: Expression(left, right)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: ShiftRightExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef SHIFTRIGHT_EXPRESSION_HXX
|
||||
#define SHIFTRIGHT_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: ShiftRightExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class ShiftRightExpression : public Expression
|
||||
{
|
||||
public:
|
||||
ShiftRightExpression(Expression *left, Expression *right);
|
||||
int evaluate() { return myLHS->evaluate() >> myRHS->evaluate(); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -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: UnaryMinusExpression.cxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "UnaryMinusExpression.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
UnaryMinusExpression::UnaryMinusExpression(Expression *left)
|
||||
: Expression(left, 0)
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: UnaryMinusExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef UNARYMINUS_EXPRESSION_HXX
|
||||
#define UNARYMINUS_EXPRESSION_HXX
|
||||
|
||||
#include "Expression.hxx"
|
||||
|
||||
/**
|
||||
@author B. Watson
|
||||
@version $Id: UnaryMinusExpression.hxx,v 1.1 2005-07-13 04:49:18 urchlay Exp $
|
||||
*/
|
||||
class UnaryMinusExpression : public Expression
|
||||
{
|
||||
public:
|
||||
UnaryMinusExpression(Expression *left);
|
||||
int evaluate() { return -(myLHS->evaluate()); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -6,17 +6,27 @@ MODULE_OBJS := \
|
|||
src/debugger/EquateList.o \
|
||||
src/debugger/Expression.o \
|
||||
src/debugger/ConstExpression.o \
|
||||
src/debugger/NotEqualsExpression.o \
|
||||
src/debugger/EqualsExpression.o \
|
||||
src/debugger/PlusExpression.o \
|
||||
src/debugger/UnaryMinusExpression.o \
|
||||
src/debugger/MinusExpression.o \
|
||||
src/debugger/MultExpression.o \
|
||||
src/debugger/DivExpression.o \
|
||||
src/debugger/ModExpression.o \
|
||||
src/debugger/LogAndExpression.o \
|
||||
src/debugger/LogOrExpression.o \
|
||||
src/debugger/LogNotExpression.o \
|
||||
src/debugger/BinNotExpression.o \
|
||||
src/debugger/BinAndExpression.o \
|
||||
src/debugger/BinOrExpression.o \
|
||||
src/debugger/BinXorExpression.o \
|
||||
src/debugger/GreaterExpression.o \
|
||||
src/debugger/GreaterEqualsExpression.o \
|
||||
src/debugger/LessExpression.o \
|
||||
src/debugger/LessEqualsExpression.o \
|
||||
src/debugger/ShiftRightExpression.o \
|
||||
src/debugger/ShiftLeftExpression.o \
|
||||
src/debugger/PackedBitArray.o \
|
||||
src/debugger/CpuDebug.o \
|
||||
src/debugger/RamDebug.o \
|
||||
|
|
|
@ -6,10 +6,11 @@
|
|||
all: stella.y
|
||||
bison -y -d stella.y
|
||||
|
||||
|
||||
calctest: stella.y calctest.c YaccParser.cxx YaccParser.hxx
|
||||
bison -y -d stella.y
|
||||
g++ -DPRINT -I../debugger -O2 -c YaccParser.cxx
|
||||
g++ -DBM -I../debugger -O2 -c calctest.c
|
||||
g++ -I../debugger -O2 -c calctest.c
|
||||
g++ -I../debugger -O2 -Wall -o calctest calctest.o YaccParser.o ../debugger/*Expression.o
|
||||
strip calctest
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: YaccParser.cxx,v 1.3 2005-07-13 02:54:13 urchlay Exp $
|
||||
// $Id: YaccParser.cxx,v 1.4 2005-07-13 04:49:19 urchlay Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -26,10 +26,30 @@
|
|||
//#endif
|
||||
|
||||
#include "Expression.hxx"
|
||||
#include "PlusExpression.hxx"
|
||||
#include "MinusExpression.hxx"
|
||||
#include "EqualsExpression.hxx"
|
||||
|
||||
#include "BinAndExpression.hxx"
|
||||
#include "BinNotExpression.hxx"
|
||||
#include "BinOrExpression.hxx"
|
||||
#include "BinXorExpression.hxx"
|
||||
#include "ConstExpression.hxx"
|
||||
#include "DivExpression.hxx"
|
||||
#include "EqualsExpression.hxx"
|
||||
#include "Expression.hxx"
|
||||
#include "GreaterEqualsExpression.hxx"
|
||||
#include "GreaterExpression.hxx"
|
||||
#include "LessEqualsExpression.hxx"
|
||||
#include "LessExpression.hxx"
|
||||
#include "LogAndExpression.hxx"
|
||||
#include "LogOrExpression.hxx"
|
||||
#include "LogNotExpression.hxx"
|
||||
#include "MinusExpression.hxx"
|
||||
#include "ModExpression.hxx"
|
||||
#include "MultExpression.hxx"
|
||||
#include "NotEqualsExpression.hxx"
|
||||
#include "PlusExpression.hxx"
|
||||
#include "ShiftLeftExpression.hxx"
|
||||
#include "ShiftRightExpression.hxx"
|
||||
#include "UnaryMinusExpression.hxx"
|
||||
|
||||
namespace YaccParser {
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -23,6 +23,7 @@ void yyerror(char *e) {
|
|||
%left '*' '/' '%'
|
||||
%left LOG_OR
|
||||
%left LOG_AND
|
||||
%left LOG_NOT
|
||||
%left '|' '^'
|
||||
%left '&'
|
||||
%left SHR SHL
|
||||
|
@ -37,43 +38,28 @@ statement: expression { fprintf(stderr, "\ndone\n"); result.exp = $1; }
|
|||
|
||||
expression: expression '+' expression { fprintf(stderr, " +"); $$ = new PlusExpression($1, $3); }
|
||||
| expression '-' expression { fprintf(stderr, " -"); $$ = new MinusExpression($1, $3); }
|
||||
| expression '*' expression { fprintf(stderr, " *"); }
|
||||
| expression '/' expression
|
||||
{ fprintf(stderr, " /");
|
||||
/*
|
||||
if($3 == 0)
|
||||
yyerror("divide by zero");
|
||||
else
|
||||
$$ = $1 / $3;
|
||||
*/
|
||||
}
|
||||
| expression '%' expression
|
||||
{ fprintf(stderr, " %");
|
||||
/*
|
||||
if($3 == 0)
|
||||
yyerror("divide by zero");
|
||||
else
|
||||
$$ = $1 % $3;
|
||||
*/
|
||||
}
|
||||
| expression '&' expression { fprintf(stderr, " &"); }
|
||||
| expression '|' expression { fprintf(stderr, " |"); }
|
||||
| expression '^' expression { fprintf(stderr, " ^"); }
|
||||
| expression '>' expression { fprintf(stderr, " <"); }
|
||||
| expression '<' expression { fprintf(stderr, " >"); }
|
||||
| expression GTE expression { fprintf(stderr, " >="); }
|
||||
| expression LTE expression { fprintf(stderr, " <="); }
|
||||
| expression NE expression { fprintf(stderr, " !="); }
|
||||
| expression '*' expression { fprintf(stderr, " *"); $$ = new MultExpression($1, $3); }
|
||||
| expression '/' expression { fprintf(stderr, " /"); $$ = new DivExpression($1, $3); }
|
||||
| expression '%' expression { fprintf(stderr, " %%"); $$ = new ModExpression($1, $3); }
|
||||
| expression '&' expression { fprintf(stderr, " &"); $$ = new BinAndExpression($1, $3); }
|
||||
| expression '|' expression { fprintf(stderr, " |"); $$ = new BinOrExpression($1, $3); }
|
||||
| expression '^' expression { fprintf(stderr, " ^"); $$ = new BinXorExpression($1, $3); }
|
||||
| expression '>' expression { fprintf(stderr, " <"); $$ = new LessExpression($1, $3); }
|
||||
| expression '<' expression { fprintf(stderr, " >"); $$ = new GreaterExpression($1, $3); }
|
||||
| expression GTE expression { fprintf(stderr, " >="); $$ = new GreaterEqualsExpression($1, $3); }
|
||||
| expression LTE expression { fprintf(stderr, " <="); $$ = new LessEqualsExpression($1, $3); }
|
||||
| expression NE expression { fprintf(stderr, " !="); $$ = new NotEqualsExpression($1, $3); }
|
||||
| expression EQ expression { fprintf(stderr, " =="); $$ = new EqualsExpression($1, $3); }
|
||||
| expression SHR expression { fprintf(stderr, " >>"); }
|
||||
| expression SHL expression { fprintf(stderr, " >>"); }
|
||||
| expression LOG_OR expression { fprintf(stderr, " ||"); }
|
||||
| expression LOG_AND expression { fprintf(stderr, " &&"); }
|
||||
| '-' expression %prec UMINUS { fprintf(stderr, " U-"); }
|
||||
| '~' expression %prec UMINUS { fprintf(stderr, " ~"); }
|
||||
| '<' expression { fprintf(stderr, " <"); }
|
||||
| '>' expression { fprintf(stderr, " >"); }
|
||||
| '(' expression ')' { fprintf(stderr, " ()"); }
|
||||
| expression SHR expression { fprintf(stderr, " >>"); $$ = new ShiftRightExpression($1, $3); }
|
||||
| expression SHL expression { fprintf(stderr, " <<"); $$ = new ShiftLeftExpression($1, $3); }
|
||||
| expression LOG_OR expression { fprintf(stderr, " ||"); $$ = new LogOrExpression($1, $3); }
|
||||
| expression LOG_AND expression { fprintf(stderr, " &&"); $$ = new LogAndExpression($1, $3); }
|
||||
| '-' expression %prec UMINUS { fprintf(stderr, " U-"); $$ = new UnaryMinusExpression($2); }
|
||||
| '~' expression %prec UMINUS { fprintf(stderr, " ~"); $$ = new BinNotExpression($2); }
|
||||
| '!' expression %prec UMINUS { fprintf(stderr, " !"); $$ = new LogNotExpression($2); }
|
||||
| '<' expression { fprintf(stderr, " <"); /* $$ = new LoByteExpression($2); */ }
|
||||
| '>' expression { fprintf(stderr, " >"); /* $$ = new HiByteExpression($2); */ }
|
||||
| '(' expression ')' { fprintf(stderr, " ()"); $$ = $2; }
|
||||
| NUMBER { fprintf(stderr, " %d", $1); $$ = new ConstExpression($1); }
|
||||
;
|
||||
%%
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
# define NUMBER 257
|
||||
# define LOG_OR 258
|
||||
# define LOG_AND 259
|
||||
# define SHR 260
|
||||
# define SHL 261
|
||||
# define GTE 262
|
||||
# define LTE 263
|
||||
# define NE 264
|
||||
# define EQ 265
|
||||
# define UMINUS 266
|
||||
# define LOG_NOT 260
|
||||
# define SHR 261
|
||||
# define SHL 262
|
||||
# define GTE 263
|
||||
# define LTE 264
|
||||
# define NE 265
|
||||
# define EQ 266
|
||||
# define UMINUS 267
|
||||
|
||||
#line 1 "stella.y"
|
||||
|
||||
|
@ -44,12 +45,12 @@ typedef union {
|
|||
|
||||
|
||||
|
||||
#define YYFINAL 52
|
||||
#define YYFINAL 54
|
||||
#define YYFLAG -32768
|
||||
#define YYNTBASE 26
|
||||
#define YYNTBASE 28
|
||||
|
||||
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 266 ? yytranslate[x] : 28)
|
||||
#define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 30)
|
||||
|
||||
/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
|
||||
static const char yytranslate[] =
|
||||
|
@ -57,16 +58,16 @@ static const char yytranslate[] =
|
|||
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, 8, 13, 2,
|
||||
24, 25, 6, 5, 2, 4, 2, 7, 2, 2,
|
||||
2, 2, 2, 25, 2, 2, 2, 8, 14, 2,
|
||||
26, 27, 6, 5, 2, 4, 2, 7, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
16, 2, 17, 2, 2, 2, 2, 2, 2, 2,
|
||||
17, 2, 18, 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, 12, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 13, 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, 11, 2, 23, 2, 2, 2,
|
||||
2, 2, 2, 2, 12, 2, 24, 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,
|
||||
|
@ -80,7 +81,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, 1, 3, 9, 10,
|
||||
14, 15, 18, 19, 20, 21, 22
|
||||
11, 15, 16, 19, 20, 21, 22, 23
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
|
@ -88,20 +89,20 @@ static const short yyprhs[] =
|
|||
{
|
||||
0, 0, 2, 6, 10, 14, 18, 22, 26, 30,
|
||||
34, 38, 42, 46, 50, 54, 58, 62, 66, 70,
|
||||
74, 77, 80, 83, 86, 90
|
||||
74, 77, 80, 83, 86, 89, 93
|
||||
};
|
||||
static const short yyrhs[] =
|
||||
{
|
||||
27, 0, 27, 5, 27, 0, 27, 4, 27, 0,
|
||||
27, 6, 27, 0, 27, 7, 27, 0, 27, 8,
|
||||
27, 0, 27, 13, 27, 0, 27, 11, 27, 0,
|
||||
27, 12, 27, 0, 27, 17, 27, 0, 27, 16,
|
||||
27, 0, 27, 18, 27, 0, 27, 19, 27, 0,
|
||||
27, 20, 27, 0, 27, 21, 27, 0, 27, 14,
|
||||
27, 0, 27, 15, 27, 0, 27, 9, 27, 0,
|
||||
27, 10, 27, 0, 4, 27, 0, 23, 27, 0,
|
||||
16, 27, 0, 17, 27, 0, 24, 27, 25, 0,
|
||||
3, 0
|
||||
29, 0, 29, 5, 29, 0, 29, 4, 29, 0,
|
||||
29, 6, 29, 0, 29, 7, 29, 0, 29, 8,
|
||||
29, 0, 29, 14, 29, 0, 29, 12, 29, 0,
|
||||
29, 13, 29, 0, 29, 18, 29, 0, 29, 17,
|
||||
29, 0, 29, 19, 29, 0, 29, 20, 29, 0,
|
||||
29, 21, 29, 0, 29, 22, 29, 0, 29, 15,
|
||||
29, 0, 29, 16, 29, 0, 29, 9, 29, 0,
|
||||
29, 10, 29, 0, 4, 29, 0, 24, 29, 0,
|
||||
25, 29, 0, 17, 29, 0, 18, 29, 0, 26,
|
||||
29, 27, 0, 3, 0
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -110,9 +111,9 @@ static const short yyrhs[] =
|
|||
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
|
||||
static const short yyrline[] =
|
||||
{
|
||||
0, 35, 38, 39, 40, 41, 50, 59, 60, 61,
|
||||
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
|
||||
72, 73, 74, 75, 76, 77
|
||||
0, 36, 39, 40, 41, 42, 43, 44, 45, 46,
|
||||
47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
|
||||
57, 58, 59, 60, 61, 62, 63
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -123,18 +124,18 @@ static const short yyrline[] =
|
|||
static const char *const yytname[] =
|
||||
{
|
||||
"$", "error", "$undefined.", "NUMBER", "'-'", "'+'", "'*'", "'/'", "'%'",
|
||||
"LOG_OR", "LOG_AND", "'|'", "'^'", "'&'", "SHR", "SHL", "'<'", "'>'",
|
||||
"GTE", "LTE", "NE", "EQ", "UMINUS", "'~'", "'('", "')'", "statement",
|
||||
"expression", 0
|
||||
"LOG_OR", "LOG_AND", "LOG_NOT", "'|'", "'^'", "'&'", "SHR", "SHL",
|
||||
"'<'", "'>'", "GTE", "LTE", "NE", "EQ", "UMINUS", "'~'", "'!'", "'('",
|
||||
"')'", "statement", "expression", 0
|
||||
};
|
||||
#endif
|
||||
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const short yyr1[] =
|
||||
{
|
||||
0, 26, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27, 27, 27
|
||||
0, 28, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29
|
||||
};
|
||||
|
||||
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
|
||||
|
@ -142,7 +143,7 @@ static const short yyr2[] =
|
|||
{
|
||||
0, 1, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
2, 2, 2, 2, 3, 1
|
||||
2, 2, 2, 2, 2, 3, 1
|
||||
};
|
||||
|
||||
/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
|
||||
|
@ -150,27 +151,27 @@ static const short yyr2[] =
|
|||
error. */
|
||||
static const short yydefact[] =
|
||||
{
|
||||
0, 25, 0, 0, 0, 0, 0, 1, 20, 22,
|
||||
23, 21, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 26, 0, 0, 0, 0, 0, 0, 1, 20,
|
||||
23, 24, 21, 22, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 24, 3, 2, 4, 5, 6, 18, 19, 8,
|
||||
9, 7, 16, 17, 11, 10, 12, 13, 14, 15,
|
||||
0, 0, 0
|
||||
0, 0, 0, 25, 3, 2, 4, 5, 6, 18,
|
||||
19, 8, 9, 7, 16, 17, 11, 10, 12, 13,
|
||||
14, 15, 0, 0, 0
|
||||
};
|
||||
|
||||
static const short yydefgoto[] =
|
||||
{
|
||||
50, 7
|
||||
52, 8
|
||||
};
|
||||
|
||||
static const short yypact[] =
|
||||
{
|
||||
44,-32768, 44, 44, 44, 44, 44, 65,-32768, -11,
|
||||
-11,-32768, 25, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44,-32768, 81, 81, 94, 94, 94, 106, 117, 38,
|
||||
38, 125, 131, 131, -11, -11, -11, -11, -11, -11,
|
||||
49, 62,-32768
|
||||
47,-32768, 47, 47, 47, 47, 47, 47, 70,-32768,
|
||||
-11, -11,-32768,-32768, 27, 47, 47, 47, 47, 47,
|
||||
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
|
||||
47, 47, 47,-32768, 87, 87, 101, 101, 101, 114,
|
||||
125, 41, 41, 133, 139, 139, -11, -11, -11, -11,
|
||||
-11, -11, 12, 38,-32768
|
||||
};
|
||||
|
||||
static const short yypgoto[] =
|
||||
|
@ -179,47 +180,49 @@ static const short yypgoto[] =
|
|||
};
|
||||
|
||||
|
||||
#define YYLAST 152
|
||||
#define YYLAST 161
|
||||
|
||||
|
||||
static const short yytable[] =
|
||||
{
|
||||
8, 9, 10, 11, 12,-32768,-32768,-32768,-32768,-32768,
|
||||
-32768, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 1, 2, 51,
|
||||
31, 22, 23, 24, 25, 26, 27, 28, 29, 30,
|
||||
3, 4, 52, 0, 0, 0, 0, 5, 6, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 15, 16, 17,
|
||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
|
||||
28, 29, 30, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 19, 20, 21, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 23,
|
||||
24, 25, 26, 27, 28, 29, 30, 25, 26, 27,
|
||||
28, 29, 30
|
||||
9, 10, 11, 12, 13, 14,-32768,-32768,-32768,-32768,
|
||||
-32768,-32768, 53, 34, 35, 36, 37, 38, 39, 40,
|
||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
|
||||
51, 15, 16, 17, 18, 19, 20, 21, 54, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
1, 2, 0, 0, 33, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 32, 3, 4, 0, 0, 0, 0,
|
||||
0, 5, 6, 7, 15, 16, 17, 18, 19, 20,
|
||||
21, 0, 22, 23, 24, 25, 26, 27, 28, 29,
|
||||
30, 31, 32, 17, 18, 19, 20, 21, 0, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
|
||||
20, 21, 0, 22, 23, 24, 25, 26, 27, 28,
|
||||
29, 30, 31, 32, 21, 0, 22, 23, 24, 25,
|
||||
26, 27, 28, 29, 30, 31, 32, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 25, 26,
|
||||
27, 28, 29, 30, 31, 32, 27, 28, 29, 30,
|
||||
31, 32
|
||||
};
|
||||
|
||||
static const short yycheck[] =
|
||||
{
|
||||
2, 3, 4, 5, 6, 16, 17, 18, 19, 20,
|
||||
21, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 4,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 3, 4, 0,
|
||||
25, 13, 14, 15, 16, 17, 18, 19, 20, 21,
|
||||
16, 17, 0, -1, -1, -1, -1, 23, 24, 4,
|
||||
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 10, 11, 12, 13,
|
||||
14, 15, 16, 17, 18, 19, 20, 21, 11, 12,
|
||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 16, 17, 18,
|
||||
19, 20, 21
|
||||
2, 3, 4, 5, 6, 7, 17, 18, 19, 20,
|
||||
21, 22, 0, 15, 16, 17, 18, 19, 20, 21,
|
||||
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 4, 5, 6, 7, 8, 9, 10, 0, 12,
|
||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||||
3, 4, -1, -1, 27, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 17, 18, -1, -1, -1, -1,
|
||||
-1, 24, 25, 26, 4, 5, 6, 7, 8, 9,
|
||||
10, -1, 12, 13, 14, 15, 16, 17, 18, 19,
|
||||
20, 21, 22, 6, 7, 8, 9, 10, -1, 12,
|
||||
13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
|
||||
9, 10, -1, 12, 13, 14, 15, 16, 17, 18,
|
||||
19, 20, 21, 22, 10, -1, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 12, 13, 14,
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 15, 16,
|
||||
17, 18, 19, 20, 21, 22, 17, 18, 19, 20,
|
||||
21, 22
|
||||
};
|
||||
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
|
||||
#line 3 "/usr/share/bison/bison.simple"
|
||||
|
@ -929,117 +932,107 @@ yyreduce:
|
|||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
#line 35 "stella.y"
|
||||
#line 36 "stella.y"
|
||||
{ fprintf(stderr, "\ndone\n"); result.exp = yyvsp[0].exp; }
|
||||
break;
|
||||
case 2:
|
||||
#line 38 "stella.y"
|
||||
#line 39 "stella.y"
|
||||
{ fprintf(stderr, " +"); yyval.exp = new PlusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 3:
|
||||
#line 39 "stella.y"
|
||||
#line 40 "stella.y"
|
||||
{ fprintf(stderr, " -"); yyval.exp = new MinusExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 4:
|
||||
#line 40 "stella.y"
|
||||
{ fprintf(stderr, " *"); }
|
||||
#line 41 "stella.y"
|
||||
{ fprintf(stderr, " *"); yyval.exp = new MultExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 5:
|
||||
#line 42 "stella.y"
|
||||
{ fprintf(stderr, " /");
|
||||
/*
|
||||
if($3 == 0)
|
||||
yyerror("divide by zero");
|
||||
else
|
||||
$$ = $1 / $3;
|
||||
*/
|
||||
}
|
||||
{ fprintf(stderr, " /"); yyval.exp = new DivExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 6:
|
||||
#line 51 "stella.y"
|
||||
{ fprintf(stderr, " %");
|
||||
/*
|
||||
if($3 == 0)
|
||||
yyerror("divide by zero");
|
||||
else
|
||||
$$ = $1 % $3;
|
||||
*/
|
||||
}
|
||||
#line 43 "stella.y"
|
||||
{ fprintf(stderr, " %%"); yyval.exp = new ModExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 7:
|
||||
#line 59 "stella.y"
|
||||
{ fprintf(stderr, " &"); }
|
||||
#line 44 "stella.y"
|
||||
{ fprintf(stderr, " &"); yyval.exp = new BinAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 8:
|
||||
#line 60 "stella.y"
|
||||
{ fprintf(stderr, " |"); }
|
||||
#line 45 "stella.y"
|
||||
{ fprintf(stderr, " |"); yyval.exp = new BinOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 9:
|
||||
#line 61 "stella.y"
|
||||
{ fprintf(stderr, " ^"); }
|
||||
#line 46 "stella.y"
|
||||
{ fprintf(stderr, " ^"); yyval.exp = new BinXorExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 10:
|
||||
#line 62 "stella.y"
|
||||
{ fprintf(stderr, " <"); }
|
||||
#line 47 "stella.y"
|
||||
{ fprintf(stderr, " <"); yyval.exp = new LessExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 11:
|
||||
#line 63 "stella.y"
|
||||
{ fprintf(stderr, " >"); }
|
||||
#line 48 "stella.y"
|
||||
{ fprintf(stderr, " >"); yyval.exp = new GreaterExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 12:
|
||||
#line 64 "stella.y"
|
||||
{ fprintf(stderr, " >="); }
|
||||
#line 49 "stella.y"
|
||||
{ fprintf(stderr, " >="); yyval.exp = new GreaterEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 13:
|
||||
#line 65 "stella.y"
|
||||
{ fprintf(stderr, " <="); }
|
||||
#line 50 "stella.y"
|
||||
{ fprintf(stderr, " <="); yyval.exp = new LessEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 14:
|
||||
#line 66 "stella.y"
|
||||
{ fprintf(stderr, " !="); }
|
||||
#line 51 "stella.y"
|
||||
{ fprintf(stderr, " !="); yyval.exp = new NotEqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 15:
|
||||
#line 67 "stella.y"
|
||||
#line 52 "stella.y"
|
||||
{ fprintf(stderr, " =="); yyval.exp = new EqualsExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 16:
|
||||
#line 68 "stella.y"
|
||||
{ fprintf(stderr, " >>"); }
|
||||
#line 53 "stella.y"
|
||||
{ fprintf(stderr, " >>"); yyval.exp = new ShiftRightExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 17:
|
||||
#line 69 "stella.y"
|
||||
{ fprintf(stderr, " >>"); }
|
||||
#line 54 "stella.y"
|
||||
{ fprintf(stderr, " <<"); yyval.exp = new ShiftLeftExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 18:
|
||||
#line 70 "stella.y"
|
||||
{ fprintf(stderr, " ||"); }
|
||||
#line 55 "stella.y"
|
||||
{ fprintf(stderr, " ||"); yyval.exp = new LogOrExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 19:
|
||||
#line 71 "stella.y"
|
||||
{ fprintf(stderr, " &&"); }
|
||||
#line 56 "stella.y"
|
||||
{ fprintf(stderr, " &&"); yyval.exp = new LogAndExpression(yyvsp[-2].exp, yyvsp[0].exp); }
|
||||
break;
|
||||
case 20:
|
||||
#line 72 "stella.y"
|
||||
{ fprintf(stderr, " U-"); }
|
||||
#line 57 "stella.y"
|
||||
{ fprintf(stderr, " U-"); yyval.exp = new UnaryMinusExpression(yyvsp[0].exp); }
|
||||
break;
|
||||
case 21:
|
||||
#line 73 "stella.y"
|
||||
{ fprintf(stderr, " ~"); }
|
||||
#line 58 "stella.y"
|
||||
{ fprintf(stderr, " ~"); yyval.exp = new BinNotExpression(yyvsp[0].exp); }
|
||||
break;
|
||||
case 22:
|
||||
#line 74 "stella.y"
|
||||
{ fprintf(stderr, " <"); }
|
||||
#line 59 "stella.y"
|
||||
{ fprintf(stderr, " !"); yyval.exp = new LogNotExpression(yyvsp[0].exp); }
|
||||
break;
|
||||
case 23:
|
||||
#line 75 "stella.y"
|
||||
{ fprintf(stderr, " >"); }
|
||||
#line 60 "stella.y"
|
||||
{ fprintf(stderr, " <"); /* $$ = new LoByteExpression($2); */ }
|
||||
break;
|
||||
case 24:
|
||||
#line 76 "stella.y"
|
||||
{ fprintf(stderr, " ()"); }
|
||||
#line 61 "stella.y"
|
||||
{ fprintf(stderr, " >"); /* $$ = new HiByteExpression($2); */ }
|
||||
break;
|
||||
case 25:
|
||||
#line 77 "stella.y"
|
||||
#line 62 "stella.y"
|
||||
{ fprintf(stderr, " ()"); yyval.exp = yyvsp[-1].exp; }
|
||||
break;
|
||||
case 26:
|
||||
#line 63 "stella.y"
|
||||
{ fprintf(stderr, " %d", yyvsp[0].val); yyval.exp = new ConstExpression(yyvsp[0].val); }
|
||||
break;
|
||||
}
|
||||
|
@ -1275,5 +1268,5 @@ yyreturn:
|
|||
#endif
|
||||
return yyresult;
|
||||
}
|
||||
#line 79 "stella.y"
|
||||
#line 65 "stella.y"
|
||||
|
||||
|
|
|
@ -12,13 +12,14 @@ typedef union {
|
|||
# define NUMBER 257
|
||||
# define LOG_OR 258
|
||||
# define LOG_AND 259
|
||||
# define SHR 260
|
||||
# define SHL 261
|
||||
# define GTE 262
|
||||
# define LTE 263
|
||||
# define NE 264
|
||||
# define EQ 265
|
||||
# define UMINUS 266
|
||||
# define LOG_NOT 260
|
||||
# define SHR 261
|
||||
# define SHL 262
|
||||
# define GTE 263
|
||||
# define LTE 264
|
||||
# define NE 265
|
||||
# define EQ 266
|
||||
# define UMINUS 267
|
||||
|
||||
|
||||
extern YYSTYPE yylval;
|
||||
|
|
Loading…
Reference in New Issue