•   over 4 years ago

Adding Python support

I'm working on a Python solution.

I'm considering using a parser generator like PEG.js (http://pegjs.majda.cz/), or modifying an existing parser. Using a generator would likely reduce the development time, but I am concerned it will be harder to maintain and incorporate into projects like CodeCombat in the long run.

  • 3 comments

  • Moderator   •   over 4 years ago

    For a language as complex and valuable as Python, I feel like modifying an existing parser or writing one would be more useful–I had a quick look at PEG.js's parser code output, and while pretty clean for what it is, I think you're right that it would be hard to maintain and debug going forward, being machine-generated like that.

    There are several Python-in-JS projects that might have parsers that would be easier to start adapting: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS#python

  •   •   over 4 years ago

    Thanks for the info!

    What's the best way to integrate a new parser into a Coco development environment for testing purposes?

  • Moderator   •   over 4 years ago

    Fork Aether, look for everything that references "coffee" in src/ and tests/, and add a parallel "python" version to tell it that it can now use Python. (We'll come up with a better plugin system after the third language is working.) Add some tests and then get them to pass.

    Once very, very basic tests are passing, we can add it to CodeCombat like this:

    https://github.com/codecombat/codecombat/pull/545

    Excited to see Python parser progress!

Comments are closed.