[llvm-dev] General question - better descriped.

mayuyu.io via llvm-dev llvm-dev at lists.llvm.org
Thu Jun 20 11:52:11 PDT 2019


As far as I understand it you are basically trying to create your own domain specific language for scientific computation?
Clang seems to kinda match what you need but I don’t think it’s able to support function definition in another function which sounds like something you’d need. Your best approach would be using some lexer/parser generate tool to code your own compiler frontend (GREAT DEAL OF WORK) or hack up libClang a bit. Alternatively there are a bunch of readily usable LLVM based languages like Halide that are designed for generating efficient tensor computation code so changing your workflow a bit to re-use those libraries/frameworks is probably a better idea, in my humble opinion. Unless I’m missing something obvious here.

Zhang

> 在 2019年6月20日,19:01,Steven Truppe via llvm-dev <llvm-dev at lists.llvm.org> 写道:
> 
> Hi everyone,
> 
> i'm currently trying to write an application that let you "code" with
> nodes. (think of a node like a function that has input and output slots
> that can get connected).
> 
> 
> I need a few functions that are predefined and can be used in the code
> (so i want to parse and create an AST for those functions/variables and
> then i need to parse C++ code (one node has c++ code that should be
> executed. So in the end i've nodes that are for types, then one for
> operations (the functions).
> 
> 
> The code from the nodes must be able to run the code from it's node with
> the parameters i pass to the node's slots or in the node itself and i
> need it to be able to create own functions that must be available in the
> code of the nodes.
> 
> 
> so for example i've a typenode that declares and defines variables, for
> example vec3f for 3d vector types.
> 
> 
> Now my question would be: Where should i start reading or is there a
> special article how to achive what i want ?? As far as i know i need
> clang to parse my own functions so he knows about my types and my
> functions (one for each operation nodes and the structure declarations).
> this creates one AST for each type/function). then i need to build an
> AST for my own nodes that must be interpreted and compiled with llvm and
> then run the code at runtime.
> 
> 
> I hope one of you guys can point me in the right direction because i'm
> completely new to clang and llvm (but i found a book about "learning
> llvm basic libaries that helps a bit but they do not talk much about
> clang (so i only know the basics about llvm and have not much of a clue
> about clang.
> 
> 
> best regards,
> 
> Steven Truppe
> 
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev





More information about the llvm-dev mailing list