Giter Club home page Giter Club logo

Comments (4)

erezsh avatar erezsh commented on July 30, 2024

Hi,
Sounds interesting! What kind of transpiler?

  1. The Python grammars are provided as an example, and not as a feature of Lark. However, if it's for an open-source project, I might consider making them a feature, which means keeping them up-to-date and bug-free. As it is, python3.g is currently fully compatible with Python 3.6, as far as I'm aware.

  2. If you run python3 -m examples.python_parser you will see that it runs on the entire standard library of Python. If you wish to test it on other files, it should be easy to add. An error-free run always means a successful parse and tree generation.

One more point: While the grammars can parse and generate python fully, the resulting trees are not necessarily convenient to work with. It's probably a good idea to do some refactoring in the grammars first.

from lark.

nightblade9 avatar nightblade9 commented on July 30, 2024

Hi,

You can find details about my transpiler here. It transpiles Python 3 to Haxe, which provides me with a solid cross-platform game development engine back-end (HaxeFlixel, Kha, etc.)

It's really just an experiment. Transpiling Python to Haxe means I can transpile again (via the Haxe compiler) to Java/C++ (run on Android), Javascript/Flash (run on web), iOS, Windows, Linux, Mac.

  1. Let me know if you decide to make it a supported feature. For now, I'll use Lark for prototyping and I can live with an out-of-date Python 3 grammar (if it comes to that).

  2. That's great; I'm looking for something more like unit testing. I think the best thing for me, personally to do, is fork Lark, and start writing unit tests for simple Python cases (eg. classes, modules, static methods, etc.) That way, if future versions break (or the grammar breaks), I can pin-point where.

  3. Since Haxe code gets transpiled anyway, I don't have an issue if the resulting code quality is poor to work with. I don't have any experience with grammars, ASTs, etc. so I won't be much help there.

Thanks for the feedback!

from lark.

erezsh avatar erezsh commented on July 30, 2024
  1. No problem. If you into any problems with it, feel free to comment here or email me. I might be able to give you some advice.

  2. You should have a look at: https://github.com/erezsh/plyplus/blob/master/plyplus/test/python4ply-sample.py -- It's an attempt to construct unit-tests for Python 2 syntax, and maybe you can use it as a starting point.

  3. You'll see what I mean when you start working with the resulting AST. I think by then you'll know what you need to do to solve it, but if not, feel free to ask me.

I like your idea. Good luck!

from lark.

nightblade9 avatar nightblade9 commented on July 30, 2024

Thanks! I will definitely let you know if I get stuck, and I am definitely going to be waiting to hear if you decide to support Python or not.

FYI, I decided not to fork Lark, but instead treat the choice of tree-generator as an abstraction in my code. I'll write some sanity tests, and if it makes sense, these can move into Lark (or whichever tree-generator I use) library in the future.

from lark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.