How does the parser distinguish between type aliases and primitive types? #904
-
Hi guys, I've been playing with the Earley parser lately, and I found that the Earley parser (at least lark's earley implementation) treats type aliases (such as A snippet of the grammar:
It makes sense to identify My guess is: the keywords are collected by the parser generator and have a higher precedence than user-defined terminals. Update: The question has been answered in #792 , keywords do take higher precedence. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Just for other users who stumble upon this question As @luan-xiaokun correctly points out, in #792 the precedence of keywords compared to terminals is explained. This allows correct lexing of keywords which would be otherwise identified as IDs or similar terminals. This behavior is implemented in the |
Beta Was this translation helpful? Give feedback.
Just for other users who stumble upon this question
As @luan-xiaokun correctly points out, in #792 the precedence of keywords compared to terminals is explained. This allows correct lexing of keywords which would be otherwise identified as IDs or similar terminals. This behavior is implemented in the
DefaultTokenBuilder
class.