Let's say I want to parse my new language that looks like this:
main.mylang
import "tags.mylang"
cat dog bacon
And there's another file tags.mylang
that looks like this:
cat "meow"
dog "woof"
bacon "sizzle"
Running main.mylang
would output
meow woof sizzle
The problem I'm having is that "cat", "dog", and "bacon" are defined in a separate file, as implemented my the mylang
developer; i.e., I can't make them part of the grammar beforehand.
Is it possible to dynamically add these tags into the grammar as it's parsing? I don't want to add a wildcard \w+
or something because I want it to error on unrecognized tags.
Edit: I'm writing this using jison
, which is based on bison
.