protected function getMainFunction()
    {
        $mainFunction = '
Void FML_Dummy() {}
main() {
	declare ' . self::VAR_ScriptStart . ' = Now;
	+++' . ScriptLabel::ONINIT . '+++
	declare ' . self::VAR_LoopCounter . ' = 0;
	declare ' . self::VAR_LastTick . ' = 0;
	while (True) {
		yield;
		foreach (Event in PendingEvents) {
			switch (Event.Type) {
				case CMlEvent::Type::EntrySubmit: {
					+++' . ScriptLabel::ENTRYSUBMIT . '+++
				}
				case CMlEvent::Type::KeyPress: {
					+++' . ScriptLabel::KEYPRESS . '+++
				}
				case CMlEvent::Type::MouseClick: {
					+++' . ScriptLabel::MOUSECLICK . '+++
					+++' . ScriptLabel::MOUSECLICK2 . '+++
				}
				case CMlEvent::Type::MouseOut: {
					+++' . ScriptLabel::MOUSEOUT . '+++
				}
				case CMlEvent::Type::MouseOver: {
					+++' . ScriptLabel::MOUSEOVER . '+++
				}
			}
		}
		+++' . ScriptLabel::LOOP . '+++
		' . self::VAR_LoopCounter . ' += 1;
		if (' . self::VAR_LastTick . ' + ' . self::TICKINTERVAL . ' > Now) continue;
		+++' . ScriptLabel::TICK . '+++ 
		' . self::VAR_LastTick . ' = Now;
	}
}';
        return $mainFunction;
    }