Feature: Support hierarchical grammar definitions
This is definitely just a nice-to-have issue, but it would make declaring strict grammars less redundant.
Description
I'd like to have a base grammar defining the fundamental structure of my elements, e.g., which fields are required for all "Requirements", all "Specifications", etc ... This is useful in complex projects that have several levels of requirement and specification documents, e.g., product requirements, system requirements, software requirements, etc.
Let's say req_base.sgra defines the minimal language elements for all requirements documents, then each requirements document grammar type, e.g., req_sw.sgra for software requirements, includes req_base.sgra and can extend the elements in req_sw.sgra, e.g., for the required trace types in software requirement documents.
With this, I don't have to redefine "Requirement" types, e.g., that a UUID is required for each such element, in each and every document grammar.
Problem
Currently (strictdoc 0.8.0), using IMPORT_FROM_FILE doesn't seem to work in grammar files even though no error is generated. If I try the above, then I get the Semantic error: Invalid node type: REQUIREMENT. in the document including req_base.sgra since no such element type is defined (at the moment all I'm doing in my req_sw.sgra is including req_base.sgra).
Without this feature, I have to re-declare my elements in each and every document's grammar, which is repetitive, error prone, and might become inconsistent.
Solution
I'm not sure about the underlying implementation - but subsequent inclusion could be used to extend grammars defined in other files. Conflicting definitions could be forbidden to simplify things in the implementation.
Additional Information
N/A.
Hi @lmapii,
Just a small heads-up. The feature would be nice to have, someone just has to implement it.
A little more challenging aspect is how to also implement editing of hierarchical grammars in the editable user interface. One shortcut could be to disallow editing them in the UI and just present a banner that this is not supported yet if someone tries to edit such a grammar with the UI. StrictDoc already has plenty of features that are only available through IDE-only, so this will be another one.
If you have a good vision of how this could work in the SDoc markup, I could support you in doing this work by yourself. Otherwise, the priorities for the core team can be somewhere else unless this ticket is requested strongly by more users.