Skip to content

Feature: Support hierarchical grammar definitions #2300

@lmapii

Description

@lmapii

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions