I have been attempting to solve for the problem of language embedding, in various ways, for years. The root cause of the complexity is that different parsing schemes are executed as a document is passed through different applications ignoring the remainder of the given document outside the delimiters of the syntax concerned by the parser at present. There are consequences to that approach in performance, integrity, and structure. This became apparent when I encountered documents containing FreeMarker code and Handlebar code in a way that did not respect the structure of each other template scheme but made sense in isolation.
I was able to solve for embedding by realizing that embedding is a data structure imposed upon the outer language. If a language is reduced to a primitive structure, such as a parse tree, then all languages become equally represented as various data structures. That won’t make practical sense unless the structure representing these languages is uniform. If there were a common parse tree to all languages that represents respective languages as data structures and the points of embedding are just child structures apart from the whole the problem of embedding is solved for.
Because everything is represented as simple structures in a set of like structures recursion from nesting is accounted for without increased complexity. An example in this case would be to embed an instance of assembly in the outer F* grammar which then contains as instance of F* as a string or comment in that assembly.
A demo of the simplified and uniform parsing scheme is at https://prettydiff.com/parse-framework/runtimes/browsertest.... but at this time only a few languages are supported. I am still working on expanding support and proving the concept. Unlike the research paper though, a data structure alone is not enough to provide verification, which requires a proof of some sort.
 - https://www.fstar-lang.org/