rascal icon indicating copy to clipboard operation
rascal copied to clipboard

Implement `tag` declarations in type-checker

Open jurgenvinju opened this issue 2 years ago • 1 comments

This is what the grammar now says on Declaration:

\tag : Tags tags Visibility visibility "tag" Kind kind Name name "on" {Type ","}+ types ";"

this does not make sense to me anymore. I'd say we'd like to declare a name and the type of value that is expected for that tag name, and on which other declarations:

function tag str @ignore would declare the tag @ignore to accept string values. function tag str @synopsis test tag int @maxDepth

etc.

jurgenvinju avatar Jul 07 '23 09:07 jurgenvinju

I noticed accidentally that some tag processing code is very brittle. I.e. an additional space or newline breaks the code in @maxDepth. A type-check would help in detecting issues before they cause harm, and also it could help with processing the data easier.

  • parse values with the parser that matches the type (int must be an int)
  • also allow for concrete syntax in tagstrings, i.e. @statement{int i = 0;} would be parsed with the MyParser non-terminal because: function tag MyParser @statement;

jurgenvinju avatar Jul 07 '23 09:07 jurgenvinju