How to parse mqh and mq4/5 files with clang preprocessor?

 
While investigating another issue, I came across the situation where I would need to see the results of macro substitution within the source file, or better their results.

So I tried to make clang's preprocessor read and output the mq4/5 and included mqh files. But I am unsuccessful in making clang read these files as c/c++ and do the preprocessing on them.

How (and with what tools) could I preprocess a multi file mql4/5 project and get the resulting source code?

As  a note, I am not very familiar with clang, usually I use VC++, but I thought it might be easier with gcc or clang. - Not bound to any, only I don't want to use online services.
 
Would be interesting to have this feature directly in MetaEditor.
 
Dominik Christian Egert: While investigating another issue, I came across the situation where I would need to see the results of macro substitution within the source file, or better their results. So I tried to make clang's preprocessor read and output the mq4/5 and included mqh files. But I am unsuccessful in making clang read these files as c/c++ and do the preprocessing on them. How (and with what tools) could I preprocess a multi file mql4/5 project and get the resulting source code? As  a note, I am not very familiar with clang, usually I use VC++, but I thought it might be easier with gcc or clang. - Not bound to any, only I don't want to use online services.

In the past I have seen independent implementations of preprocessors that can be used on any languages with a similar syntax to C/C++.

Maybe you can do a search for those, as they will probably be a better fit for MQL.

 
Fernando Carreiro #:

In the past I have seen independent implementations of preprocessors that can be used on any languages with a similar syntax to C/C++.

Maybe you can do a search for those, as they will probably be a better fit for MQL.

Thank you @Fernando Carreiro, I actually found something quite promissing, Sadly there is no prebuilt Windows version available.


Its published under LGPL and called General Pre Processor.

https://logological.org/gpp

Tristan Miller and Denis Auroux. GPP, the generic preprocessor. Journal of Open Source Software, 5(51), July 2020. ISSN 2475-9066. DOI: 10.21105/joss.02400.


Here the GitHub link: 

https://github.com/logological/gpp

GPP, the Generic Preprocessor
GPP, the Generic Preprocessor
  • joss.theoj.org
Miller et al., (2020). GPP, the Generic Preprocessor. Journal of Open Source Software, 5(51), 2400, https://doi.org/10.21105/joss.02400
Reason: