Alec Taylor
2015-Jun-30 01:52 UTC
[LLVMdev] LLVM parsers for popular languages? - Python, Rust, Go
IIRC when LLVM came out a bunch of community-contributed parsers were available on your website. Essentially I want to read in a programming language, prune the AST until it contains only what I define as a "summary", then convert that AST to that of another language, before finally outputting [code-generating] a compilable/interpretable source [think boilerplate]. Would be good to have Python, Rust and Go. Are there any LLVM parsers around for these popular languages? - I can write my own, but then I'd need to maintain them against the latest language specs >.< Thanks for all suggestions -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150630/fb5359d0/attachment.html>
mats petersson
2015-Jun-30 07:52 UTC
[LLVMdev] LLVM parsers for popular languages? - Python, Rust, Go
Typically, the AST is language-specific [as concepts in one language often doesn't exist at all in another language, e.g. Python List and Dictionaries don't exist in C], so outputting it as "another language" is not always easy (or even possible without much infrastructure in the target language). I also have absolutely no idea what you mean by "Summary" - I expect you mean the essential parts of the code, minus error checking and such, but I have a hard time understanding how you differentiate between the algorithm's essential parts, and "unnecessary error checks" [unless your code understands the algorithm, but then you could just as well write a program that outputs various algorithms in different languages, which would be easier than taking in source in one language and output it in another language]. -- Mats On 30 June 2015 at 02:52, Alec Taylor <alec.taylor6 at gmail.com> wrote:> IIRC when LLVM came out a bunch of community-contributed parsers were > available on your website. > > Essentially I want to read in a programming language, prune the AST until > it contains only what I define as a "summary", then convert that AST to > that of another language, before finally outputting [code-generating] a > compilable/interpretable source [think boilerplate]. > > Would be good to have Python, Rust and Go. > > Are there any LLVM parsers around for these popular languages? - I can > write my own, but then I'd need to maintain them against the latest > language specs >.< > > Thanks for all suggestions > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150630/d855825e/attachment.html>
Antoine Pitrou
2015-Jul-01 12:23 UTC
[LLVMdev] LLVM parsers for popular languages? - Python, Rust, Go
Hi, Alec Taylor <alec.taylor6 <at> gmail.com> writes:> > Would be good to have Python, Rust and Go.Are there any LLVM parsers > around for these popular languages?A programming language is much more than a parser and AST. It has specific semantics, and a runtime (in the case of Python, the runtime is very large as it hosts a lot of functionality). So it wouldn't make much sense to have "just a parser". However, if you are looking for an implementation of a subset of Python using LLVM, you can take a look at Numba: http://numba.pydata.org/ (disclaimer: I am part of the Numba team) Regards Antoine.
Alec Taylor
2015-Jul-04 06:35 UTC
[LLVMdev] LLVM parsers for popular languages? - Python, Rust, Go
Thanks, happy to of confirmed. With that in mind, will use the AST modules provided by the languages (with the exception of libclang for C++). Antoine: Am aware of Numba, nice job there BTW. So is there a [decoupled] LLVM parser which I can use to read Python files and analyse objects (including computing their attributes in OO and setattr scenarios)? On Wed, Jul 1, 2015 at 10:23 PM, Antoine Pitrou <antoine at python.org> wrote:> > Hi, > > Alec Taylor <alec.taylor6 <at> gmail.com> writes: > > > > Would be good to have Python, Rust and Go.Are there any LLVM parsers > > around for these popular languages? > > A programming language is much more than a parser and AST. It has > specific semantics, and a runtime (in the case of Python, the runtime is > very large as it hosts a lot of functionality). > > So it wouldn't make much sense to have "just a parser". > > However, if you are looking for an implementation of a subset of Python > using LLVM, you can take a look at Numba: http://numba.pydata.org/ > > (disclaimer: I am part of the Numba team) > > Regards > > Antoine. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150704/9d71e72c/attachment.html>