53 using Args = std::vector<CompilerValue *>;
67 CompilerValue *addTargetFunctionCall(
const std::string &functionName, StaticType returnType = StaticType::Void,
const ArgTypes &argTypes = {},
const Args &args = {});
68 CompilerValue *addFunctionCallWithCtx(
const std::string &functionName, StaticType returnType = StaticType::Void,
const ArgTypes &argTypes = {},
const Args &args = {});
69 CompilerConstant *addConstValue(
const Value &value);
70 CompilerValue *addStringChar(CompilerValue *
string, CompilerValue *index);
71 CompilerValue *addStringLength(CompilerValue *
string);
72 CompilerValue *addLoopIndex();
73 CompilerValue *addLocalVariableValue(CompilerLocalVariable *variable);
74 CompilerValue *addVariableValue(Variable *variable);
75 CompilerValue *addListContents(List *list);
76 CompilerValue *addListItem(List *list, CompilerValue *index);
77 CompilerValue *addListItemIndex(List *list, CompilerValue *item);
78 CompilerValue *addListContains(List *list, CompilerValue *item);
79 CompilerValue *addListSize(List *list);
80 CompilerValue *addProcedureArgument(
const std::string &name);
82 CompilerValue *addInput(
const std::string &name);
83 CompilerValue *addInput(Input *input);
85 CompilerValue *createAdd(CompilerValue *operand1, CompilerValue *operand2);
86 CompilerValue *createSub(CompilerValue *operand1, CompilerValue *operand2);
87 CompilerValue *createMul(CompilerValue *operand1, CompilerValue *operand2);
88 CompilerValue *createDiv(CompilerValue *operand1, CompilerValue *operand2);
90 CompilerValue *createRandom(CompilerValue *from, CompilerValue *to);
91 CompilerValue *createRandomInt(CompilerValue *from, CompilerValue *to);
93 CompilerValue *createCmpEQ(CompilerValue *operand1, CompilerValue *operand2);
94 CompilerValue *createCmpGT(CompilerValue *operand1, CompilerValue *operand2);
95 CompilerValue *createCmpLT(CompilerValue *operand1, CompilerValue *operand2);
97 CompilerValue *createStrCmpEQ(CompilerValue *string1, CompilerValue *string2,
bool caseSensitive =
false);
99 CompilerValue *createAnd(CompilerValue *operand1, CompilerValue *operand2);
100 CompilerValue *createOr(CompilerValue *operand1, CompilerValue *operand2);
101 CompilerValue *createNot(CompilerValue *operand);
103 CompilerValue *createMod(CompilerValue *num1, CompilerValue *num2);
104 CompilerValue *createRound(CompilerValue *num);
105 CompilerValue *createAbs(CompilerValue *num);
106 CompilerValue *createFloor(CompilerValue *num);
107 CompilerValue *createCeil(CompilerValue *num);
108 CompilerValue *createSqrt(CompilerValue *num);
109 CompilerValue *createSin(CompilerValue *num);
110 CompilerValue *createCos(CompilerValue *num);
111 CompilerValue *createTan(CompilerValue *num);
112 CompilerValue *createAsin(CompilerValue *num);
113 CompilerValue *createAcos(CompilerValue *num);
114 CompilerValue *createAtan(CompilerValue *num);
115 CompilerValue *createLn(CompilerValue *num);
116 CompilerValue *createLog10(CompilerValue *num);
117 CompilerValue *createExp(CompilerValue *num);
118 CompilerValue *createExp10(CompilerValue *num);
120 CompilerValue *createStringConcat(CompilerValue *string1, CompilerValue *string2);
122 CompilerValue *createSelect(CompilerValue *cond, CompilerValue *trueValue, CompilerValue *falseValue, Compiler::StaticType valueType);
124 CompilerLocalVariable *createLocalVariable(Compiler::StaticType type);
125 void createLocalVariableWrite(CompilerLocalVariable *variable, CompilerValue *value);
127 void createVariableWrite(Variable *variable, CompilerValue *value);
129 void createListClear(List *list);
130 void createListRemove(List *list, CompilerValue *index);
131 void createListAppend(List *list, CompilerValue *item);
132 void createListInsert(List *list, CompilerValue *index, CompilerValue *item);
133 void createListReplace(List *list, CompilerValue *index, CompilerValue *item);
135 void beginIfStatement(CompilerValue *cond);
136 void beginElseBranch();
139 void beginWhileLoop(CompilerValue *cond);
140 void beginRepeatUntilLoop(CompilerValue *cond);
141 void beginLoopCondition();
144 void moveToIf(CompilerValue *cond, Block *substack);
145 void moveToIfElse(CompilerValue *cond, Block *substack1, Block *substack2);
146 void moveToRepeatLoop(CompilerValue *count, Block *substack);
147 void moveToWhileLoop(CompilerValue *cond, Block *substack);
148 void moveToRepeatUntilLoop(CompilerValue *cond, Block *substack);
153 void createStopWithoutSync();
155 void createProcedureCall(BlockPrototype *prototype,
const Compiler::Args &args);
157 Input *input(
const std::string &name)
const;
158 Field *field(
const std::string &name)
const;
160 const std::unordered_set<std::string> &unsupportedBlocks()
const;
162 static std::shared_ptr<CompilerContext> createContext(IEngine *engine, Target *target);
165 spimpl::unique_impl_ptr<CompilerPrivate> impl;
The CompilerContext represents a context for a specific target which is used with the Compiler class.
Definition compilercontext.h:17