Skip to content

Closely related rules and checkrules are far away #150

@SimonCockx

Description

@SimonCockx

Following the guidelines of Type errors for the IDE with Xtext and Xsemantics of a certain Lorenzo Bettini, I noticed that when I want to implement a typing rule using XSemantics, the rule gets split up in one rule statement for inference and (at least) one checkrule statement for validation. However, currently in XSemantics one must first specify all the rules, and only then all of the checkrules, so these rules/checkrules that belong to each other tend to be far away, which makes it easy to lose overview.

I would suggest to allow mixing rules and checkrules, e.g.,

rule TAddition ... // infer that an addition such as `1 + 2` results in an `integer`
checkrule CheckAddition ... // check that both arguments of an addition are of type `integer`

rule TNot ... // infer that a boolean `not` operator results in a `boolean`
checkrule CheckNot ... // check that the argument of a boolean `not` is of type `boolean`

I guess this would only need a minimal change to the grammar definition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions