Replies: 5 comments 9 replies
-
I'm ready to start thinking about this. I wonder if futagoza's syntax will still work after we used I'd like to think about long-term extensibility of the grammar syntax, since we're running out of non-letter ASCII characters to give special meaning to. We haven't used |
Beta Was this translation helpful? Give feedback.
-
Is the import path relative to the .peggy file, or relative to the generated .js file? I think the first, but Typescript uses the second, so I want to make sure we are explicit in our decision. |
Beta Was this translation helpful? Give feedback.
-
I would be really-really interested in this as I'm currently working on a grammar file that's over 5000 lines long, which is getting more and more inconvenient to work with as it grows... and I'm expecting it to grow at least 2x :( |
Beta Was this translation helpful? Give feedback.
-
I've been thinking about this a lot, and I'm worried about how the imported file will be read. It should work on the web as well as in Node. There are a couple of paths I can think of:
|
Beta Was this translation helpful? Give feedback.
-
See #417 as a part of the solution. That PR does not preclude in-grammar syntax for imports. It does add grammar for parsing es6 imports in your topLevelIniitializer, so that all of the imports from library grammars can be moved to the top of the output. Those same rules could also be used to parse in-grammar import syntax one day. |
Beta Was this translation helpful? Give feedback.
-
pegjs/pegjs#523 is a proposal (with cross references to previous discussions) for adding support for importing grammars. I don't see any further discussion on this repo since the fork from pegjs, so I was curious if anyone has thought more about it.
I might try some workarounds (like just concatenating the grammars in the build process) for now. I would be interested to hear if anyone has tried this or any other approach to sharing grammars.
Beta Was this translation helpful? Give feedback.
All reactions