StagePython

Language design and compiler engineering for the leading kids' coding education company.

Logiscool needed a new version of Scoolcode, which would support coding in Python. The task was the design of a Python-like language and the implementation of a new compiler version that would support transforming Python code into the existing AST, thus allowing these new projects to use the existing runtime.

The solution I've designed is similar to the .NET framework. Each language has its custom grammar and commands but still compiles to a shared IL, which the runtime can execute. This allows the system to support cross-language imports so a StageScript project can use parts written in StagePython and vice versa. Plus, StagePython projects can import native Python modules.

The random map generator in StagePython uses the native Perlin module running in Scoolcode.

It was a challenging project due to small but essential details, like built-in functions with the same name but different functionality in the two languages and the requirement of much stricter type checks in Python.

The result is not just an extra language but a much smarter compiler (which detects more typing errors) with almost 100% test coverage, thanks to a new unit testing framework that supports reflection and expected error outcomes.

The introduction of the new language and compiler was a great success based on the feedback from content creators, trainers, and students.

đź’ˇ
Stack
Language: TypeScript
Customer
Logiscool Kft.
Logiscool Magyarország
Tekintsd meg a Logiscool oldalát, és válaszd ki gyermeked számára a legjobb programozó kurzust, workshopot vagy tábort!