Я получаю проект от
https://github.com/cchuahuico/cool-compilerобразной />
class Main inherits SuperClass {
main(): Object {{
out_string("Enter an integer greater-than or equal-to 0: ");
let input: Int in
if input < 0 then
input
-- out_string("ERROR: Number must be greater-than or equal-to 0\n")
else {
-- out_string("The factorial of ").out_int(input);
-- out_string(" is ").out_int(factorial(input));
factorial(input);
}
fi;
}};
factorial(num: Int): Int {
if num = 0 then 1 else num * factorial(num - 1) fi
};
};
class SuperClass {
out_string(str:String){};
};
< /code>
При составлении этого с Mingw у меня есть эта ошибка < /p>
:2:error:syntax error near or aat character or token '{'
:5:error:syntax error near or aat character or token 'let'
:14:error:syntax error near or aat character or token 'fi'
:15:error:syntax error near or aat character or token '}'
:23:error:syntax error near or aat character or token '('
:24:error:syntax error near or aat character or token '}'
:24:error:syntax error near or aat character or token ' '
copmilation halted due to lexical or syntax errors
Подробнее здесь: https://stackoverflow.com/questions/222 ... ol-project