Skip to content

parsing issue #135

Answered by d-frey
Shaheen47 asked this question in Q&A
Discussion options

You must be logged in to vote

...and I also just realize that this won't work either. OK, digging deeper: You probably try to write a PEGTL-equivalent of the following rule:

BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U) | [0-9]) ((PN_CHARS | '.' )* PN_CHARS)?

Besides the difference between PN_CHARS_U and PN_CHARS (the latter not being just uppercase characters) you have one major problem in your understanding of grammars: The above is a rule from a CFG (a Context-Free Grammar) and not from a PEG (a Parsing Expression Grammar). They look extremly similar, but they have a different semantic. Hence you need to adapt those rules from CFG to PEG as otherwise the naive translation will never match the optional part as the star is…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by d-frey
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #135 on December 09, 2020 09:53.