You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The grammar (now documented at https://penman.readthedocs.io/en/latest/notation.html) disallows commas in symbols (specifically the NameChar production), which is to avoid problems when parsing triples (e.g., instance(a, alphabet)), where the comma is used to delimit the source and target of the triple.
The problem is that the comma does turn up in symbols (at least from some parsers, such as CAMR), such as numbers:
:quant (x26 / 900,000)))
Furthermore, the issue with parsing triples is not an issue in practice because the source of the triple should always be a variable which is even less likely to contain commas. Since there is no other reason to forbid commas, it should be safe to allow them if triple parsing always splits on the first comma and ignores the rest.
The text was updated successfully, but these errors were encountered:
The regex-based lexer prevents having some alternative comma-less symbol for triples because then it always ignores commas, even if they occur in the target side. So for triples it needs to anticipate a number of patterns and handle them separately:
role(a,b) (a,b is the symbol)
role(a, b) (a, is the symbol)
role(a , b) (a is the symbol)
role(a ,b) (need to get comma from ,b, because role(a, ,b) would be possible if commas are allowed)
goodmami
changed the title
Allow comma in symbols
Allow comma and caret in symbols
Jan 2, 2020
Similarly, the caret ^ is only used for triple conjunctions, so it could theoretically appear in a PENMAN symbol. I have not seen it in practice, though, unlike commas.
The grammar (now documented at https://penman.readthedocs.io/en/latest/notation.html) disallows commas in symbols (specifically the
NameChar
production), which is to avoid problems when parsing triples (e.g.,instance(a, alphabet)
), where the comma is used to delimit the source and target of the triple.The problem is that the comma does turn up in symbols (at least from some parsers, such as CAMR), such as numbers:
Furthermore, the issue with parsing triples is not an issue in practice because the source of the triple should always be a variable which is even less likely to contain commas. Since there is no other reason to forbid commas, it should be safe to allow them if triple parsing always splits on the first comma and ignores the rest.
The text was updated successfully, but these errors were encountered: