felipemanga/PyInSky

Add compile-only button

Opened this issue · 2 comments

Currently there's no way to check if the code will compile without running the game.
It would be good to have a button that compiles the code and reports any errors without actually running the game afterwards.

For context, simplified: compilation consists of two "phases": In the browser, the source code is converted into bytecode. In the cloud, the bytecode is further processed, C++ code is generated, GCC makes a bin.

Since Python is a scripting language, very few static checks are done, so a compile-only button is of limited use. It might actually be misleading: compilation will pass, but the actual game can be totally broken.

Later on I plan on experimenting with generating the bytecode soon after a file is saved, so you can see syntax errors before triggering a compilation. Since this is done in the browser, it should result in a better user experience.

I know a lot of stuff is only checked at runtime, but there are some things that could possibly be checked at compile time, like imports and (as you mention) invalid syntax.

Perhaps there are some aspects of Python that I'm not aware of that would make this difficult.
I've already discovered that a lot of the special behaviour is implemented through Python functions in a manner that may be only determinable at runtime.