Parse FIDL files and write custom code generator in python

239 views
Skip to first unread message

manoj...@gmail.com

unread,
Sep 22, 2018, 7:22:19 AM9/22/18
to Franca
Hi,

How do we parse FIDL files and write some custom code generator that can produce some custom code in python.
Basically, i need to be able to produce some custom python code from FIDL file. How do I go about this.

Klaus Birken

unread,
Sep 22, 2018, 8:09:22 AM9/22/18
to Franca
Hi,

with Eclipse Franca, you get a ANTLR-based parser generated by Xtext and a Java API for accessing loaded Franca models (the Java API is generated by EMF and is documented in the Franca User's Guide). You can access the API with all kinds of JVM-based languages (Java, Xtend, ...). I don't know if there is a Python<=>Java bridge which would allow to access this from Python.

Maybe you want to have a look into another implementation of Franca, which has been done in Python. As this Python-based Franca is a separate endeavor, I do not know which version of Franca IDL it supports. AFAIK, one of the major differences is that Deployment models are not supported at all. Here is the link: https://github.com/zayfod/pyfranca

Hope this helps, regards,
Klaus

Klaus Birken

unread,
Sep 22, 2018, 8:14:05 AM9/22/18
to Franca
I just re-read your question - if you just want to generate Python code, but the code generator might be _implemented_ in any language, I would propose to use Eclipse Franca and implement the code generator in Xtend (which is a Java-like language with special features for text generation). As a starting point, you can look at the example generator which is part of Franca:  https://github.com/franca/franca/blob/master/examples/org.franca.examples.basic/src/org/franca/examples/basic/generators/ExampleHppGenerator.xtend

More generators are available in different repositories, e.g., CommonAPI C++ (check out capicxx-core-tools on github), joynr (also on github), and many more. We also developed Python code generators for customers...

Regards,
Klaus


manoj aws

unread,
Sep 23, 2018, 3:30:37 AM9/23/18
to klaus....@gmail.com, franca-f...@googlegroups.com
Thanks Klaus. That helps. I'll try out the implementation in xtend. 

--
You received this message because you are subscribed to a topic in the Google Groups "Franca" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/franca-framework/I9MEupmJtDE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to franca-framewo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages