Let's say I have some kind of grammar, but it works by itself, but the JS code does not recognize it. Is there such an option so that you can combine the code of your grammar and syntax in one.
Let's say I have this grammar (Nearley + Moo).
@{%
const lexer = moo.compile({
start_tag: "<",
tag: /A-Z.../,
close_tag: ">"
})
%}
elemcreation -> "<" %tag ">"
That is, my grammar recognizes such this syntax, and works only with it, but how can I make it possible to write and combine the syntax of my grammar and the grammar of the JS itself. That is JSX i want to do it in JS.
That is:
// my grammar syntax
"< tag >"
// js grammar syntax
"const mycon = "Hello, world!";"
How to make it possible to combine them, but not by defining the entire js syntax in nearley