Cross referencing from DSL to Other language(eg, .C,Cpp,.py) #890
Answered
by
spoenemann
open-domain
asked this question in
Q&A
|
Hello Team I have an usecase in my DSL, where I have to map/reference a variable/function from languages like Python,C,CPP(.py,.c,.cc,.cpp,.h,.hpp). Is it possible ? what would be your recommendation ? MfG |
Answered by
spoenemann
Jan 30, 2023
Replies: 1 comment 1 reply
|
That likely requires a lot of effort, as you'd need a parser for Python/C++ and integrate it into your DSL language server. My recommendation: declare the variable/function in your DSL and generate Python/C/C++ files declaring the variable/function in those languages (e.g. C/C++ header file). Then you can reference the symbols both in the DSL and in the target languages without the need to parse each other's code. |
1 reply
Answer selected by
msujew
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That likely requires a lot of effort, as you'd need a parser for Python/C++ and integrate it into your DSL language server.
My recommendation: declare the variable/function in your DSL and generate Python/C/C++ files declaring the variable/function in those languages (e.g. C/C++ header file). Then you can reference the symbols both in the DSL and in the target languages without the need to parse each other's code.