sfall
sfall copied to clipboard
Empty statements not working?
empty statements in blocks are allowed: This is just a convenience to save scripters a bit of memory. Some of the macros in the fallout headers include their own semicolons while others do not. With the original compiler you had to remember which was which, and if you got it wrong the script would not compile. Now it's always safe to include your own semicolon, even if the macro already had its own.
Trying with 4.2.8.1:
$ cat 1.ssl
#define my_macro display_msg("foo");
procedure start begin
my_macro;
end
$ wine ~/bin/compile.exe -p -n -l -O2 -q 1.ssl -o 1.int
Compiling 1.ssl
[Error] <1.ssl>:5:4: expecting ';'.
*** THERE WERE ERRORS (1 of them) ***
Tried some earlier 4.x versions, also no go.
Removing the semicolon from one of them should work. I tried the sslc as old as 3.3, and it still gives the same error.
Sure, but the point is exactly not having to remove the semicolon. If the readme is wrong and it never worked, then consider it a feature request.
All macro definitions are written without ;
at the end.
Consider this a syntax rule.
I agree, this looks like a bug. Either we should add this feature or remove this message from the docs.
The first mention of this "feature" is in 2.11, but even the compile.exe from 2.11 doesn't work with the example.
Is it a big problem to allow this?
Is it a big problem to allow this?
I don't think so. Just a matter of tweaking the parser a bit.
Just a matter of tweaking the parser a bit.
Предлагаю вам этим и заняться. :) У меня от кода того парсера голова пухнет, все очень там запутано. в общем си код там говно, и отлаживать его еще тот АД.
Did some quick comparison. The major change from sslc 2.9 to 2.11 is including the mcpp preprocessor, but I failed to notice if Timeslip added extra handling for semicolon.
У меня от кода того парсера голова пухнет, все очень там запутано. в общем си код там говно, и отлаживать его еще тот АД.
Я лет 5 на него не смотрел, но помню что именно парсер там супер-простой. Если нужно небольшое изменение внести - это элементарно. А вот новые фичи которые требуют много изменений - уже сложновато.
А там парсер рукописный (и где он вообще)? Обычно если парсер в виде какой-то грамматики, то вносить изменения не сложно, что мелкие, что средней тяжести.
А там парсер рукописный (и где он вообще)?
parse.c Кажется это просто забыли вставить или заменить все вызовы на это https://github.com/FakelsHub/int-sslc/blob/fd413466afd60b8c2a35cf748f1788267372d193/sslc/parse.c#L1617
@NovaRain
you can try replacing the second argument of the function parseStatementInternal(p, 1);
to 0 and see how the compiler will work.
I have doubts that this didn't work well, so it was eventually disabled.
@NovaRain you can try replacing the second argument of the function
parseStatementInternal(p, 1);
to 0 and see how the compiler will work. I have doubts that this didn't work well, so it was eventually disabled.
No good, for a code like this:
for (i = 0; i < 9; i++) begin // line 447
// do something
end
The compiler will complain [Error] <gl_0keytest.ssl>:447:17: Expected ';'
(the i in i < 9
).
The exception for parseWhile
The exception for parseWhile
OK, I replaced the parseStatement(p);
in parseBlock()
and parseIf()
with parseStatementNoSemicolon(p)
but not parseWhile()
. Both the example script and the one using for loop pass the compilation, and the decompiled results seem normal.
Not sure if parseStatementNoSemicolon(p)
should only be used for parseBlock()
thought.
Whatever you guys change, don't forget to test by re-compiling ALL original scripts (with RP scripts as well for good measure) and making sure it still works.
I would not use the method of optional semicolon characters, and would remove this description from the documentation. Ps. semicolon characters can be used as helper with parsing the code.
Problem is, some defines must have a semicolon, while others must not. And as of now you have to remember which is which all the time.
С этого момента ты должен установить нормальную IDE для разработки и не париться с запоминанием.
Как вариант сделать отдельную опцию компилятора, и тогда вся боль ляжет на того кто будет компилироваться без точки с запятой. :-)
А по факту нужно делать совсем другую функцию, которая бы убирала двойной сивол ;
Но легче это сделать в скрипт редакторе чем в этом компиляторе.
Какую это нормальную IDE? Ну даже если будет подсказка, дефайны бывают в сотни строк. Это каждый раз надо мотать смотреть. Я не вижу в чем разницу сделать опцию и сделать без опции, код ведь тот же самый?
Какую это нормальную IDE? Ну даже если будет подсказка, дефайны бывают в сотни строк. Это каждый раз надо мотать смотреть.
ну по факту никакой IDE для нашего дела не существует (есть какая-то там универсально-настраиваемая Eclipse) кроме Sfall Script Editor, который подчеркнет вашу ошибку, покажет или перейдет к макросу.
Я не вижу в чем разницу сделать опцию и сделать без опции, код ведь тот же самый?
с опцией это во первых страховка. к примеру Sfall Script Editor при парсинге кода скрипта определяет конец функции/макроса по этому символу.
ну по факту никакой IDE для нашего дела не существует
Ну вот
к примеру Sfall Script Editor при парсинге кода скрипта определяет конец функции/макроса по этому символу.
... а значит если в макросе нет и не предолагается ";", то SSE вскрякнет. Так это в нем косяк, а не страховка.
Так это в нем косяк, а не страховка.
причем тут "в нем косяк", точка запятой это часть синтаксиса SSL. поди напиши разработчикам питона, что там их отступы к черту не нужны, тебя отправят к царю))) так и здесь. страховка нужна от косяков компилятора, которые вы будете искать) как пользователи данной фичи
Я вообще не понимаю, что ты имеешь ввиду. С опцией так с опцией, если хоть как-то будет компилироваться пустой statement, это будет отлично.