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