private void checkMain() {
		SymbolEntry mainEntry = SymbolTable.GLOBAL.get("main");
		if (mainEntry == null)
			throw new SemanticsMainException("main function undeclared", null);
		FunctionType mainType;
		if (mainEntry.getType() instanceof FunctionType) {
			mainType = (FunctionType) mainEntry.getType();
		} else {
			throw new SemanticsMainException("main function is of wrong type", null);
		}
		if (!mainType.getReturnType().equals(IntType.INSTANCE))
			throw new SemanticsMainException("main function must return int", null);
		if (!mainType.getParameterTypes().getTypes().isEmpty())
			throw new SemanticsMainException("main function takes no arguments", null);
		if (!mainEntry.isDefined())
			throw new SemanticsMainException("main function declared but not defined", null);
	}