2010-06-28 16:27:45 +00:00
|
|
|
#ifndef COMPILER_GENERATOR_H_INCLUDED
|
|
|
|
#define COMPILER_GENERATOR_H_INCLUDED
|
|
|
|
|
|
|
|
#include <vector>
|
2010-06-30 10:04:26 +00:00
|
|
|
#include <string>
|
2010-06-28 16:27:45 +00:00
|
|
|
|
|
|
|
#include <components/interpreter/types.hpp>
|
|
|
|
|
|
|
|
namespace Compiler
|
|
|
|
{
|
|
|
|
class Literals;
|
|
|
|
|
|
|
|
namespace Generator
|
|
|
|
{
|
|
|
|
typedef std::vector<Interpreter::Type_Code> CodeContainer;
|
2010-06-29 08:22:55 +00:00
|
|
|
|
|
|
|
void pushInt (CodeContainer& code, Literals& literals, int value);
|
|
|
|
|
2010-06-29 08:36:42 +00:00
|
|
|
void pushFloat (CodeContainer& code, Literals& literals, float value);
|
2010-07-01 14:40:03 +00:00
|
|
|
|
|
|
|
void pushString (CodeContainer& code, Literals& literals, const std::string& value);
|
2010-06-29 08:36:42 +00:00
|
|
|
|
2010-06-29 08:22:55 +00:00
|
|
|
void assignToLocal (CodeContainer& code, char localType,
|
|
|
|
int localIndex, const CodeContainer& value, char valueType);
|
2010-06-29 10:05:22 +00:00
|
|
|
|
|
|
|
void negate (CodeContainer& code, char valueType);
|
2010-06-29 14:11:19 +00:00
|
|
|
|
|
|
|
void add (CodeContainer& code, char valueType1, char valueType2);
|
|
|
|
|
|
|
|
void sub (CodeContainer& code, char valueType1, char valueType2);
|
|
|
|
|
|
|
|
void mul (CodeContainer& code, char valueType1, char valueType2);
|
|
|
|
|
|
|
|
void div (CodeContainer& code, char valueType1, char valueType2);
|
2010-06-29 15:51:02 +00:00
|
|
|
|
|
|
|
void convert (CodeContainer& code, char fromType, char toType);
|
|
|
|
|
|
|
|
void squareRoot (CodeContainer& code);
|
2010-06-30 10:04:26 +00:00
|
|
|
|
|
|
|
void exit (CodeContainer& code);
|
|
|
|
|
|
|
|
void message (CodeContainer& code, Literals& literals, const std::string& message,
|
|
|
|
int buttons);
|
2010-06-30 10:46:10 +00:00
|
|
|
|
|
|
|
void fetchLocal (CodeContainer& code, char localType, int localIndex);
|
2010-06-30 17:58:25 +00:00
|
|
|
|
|
|
|
void jump (CodeContainer& code, int offset);
|
|
|
|
|
|
|
|
void jumpOnZero (CodeContainer& code, int offset);
|
|
|
|
|
|
|
|
void jumpOnNonZero (CodeContainer& code, int offset);
|
2010-07-01 10:19:52 +00:00
|
|
|
|
|
|
|
void compare (CodeContainer& code, char op, char valueType1, char valueType2);
|
2010-06-28 16:27:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|