Mix parsers and AST
I don't want to redefine a grammer for float, so how can I use mpc_float() and friends with mpca_lang and permit to reference it without defining it in the grammar ?
You can define it ahead of time with mpc_define , pass it in along with the other arguments to mpca_lang, and reference it using the name it was given by mpc_new.
But it doesn't work with mpc_float because it returns a float*. Will it work only if the function returns a char*?
Ah yeah, that's true - I think you can use mpc_apply(mpcf_str_ast, mpc_real()) instead since parsers used in mpca_grammar need to return a mpc_ast_t*. You can also tag that ast node with mpca_tag.