Comments (4)
Hi,
Sounds interesting! What kind of transpiler?
-
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. -
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.
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.
-
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).
-
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.
-
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.
-
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.
-
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.
-
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.
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)
- Incorrect start_pos / end_pos in the tree HOT 8
- Add `outlines` in the list of projects using Lark HOT 2
- Lark.open_from_package() does not support namespace packages HOT 2
- Stand-alone program cannot be run HOT 4
- Issue of installing lark in Python HOT 1
- Pipe in terminal regex not working as expected HOT 1
- Transformer Not Applying Expected Transformations in Lark Parser HOT 3
- Deprecation Warning HOT 6
- accepts() vs choices() in InteractiveParser HOT 10
- No such file or directory: 'COMMON.lark' HOT 4
- Grammar Syntax For Unordered Groups HOT 1
- Is it possible to parse parts of the input? HOT 12
- Forgiving syntax HOT 3
- Post 1388 changes HOT 4
- Dynamic Earley: Incorrect value for SymbolNode.end
- Inconsistent parse results from simple ambiguous grammar HOT 4
- Superfluous identical ambiguities in Earley HOT 2
- Porting from pyparsing match_previous_literal HOT 4
- _TERMINAL appears in tree HOT 1
- Lexer matches shorter literals before longer literals HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lark.