Skip to content
Advertisement

Tag: grammar

What is NAME in the Python3 grammar specification

I wish to contribute to an open-source Python lexer. I’m looking at the official Python3 grammar specification: https://docs.python.org/3/reference/grammar.html However, there are a lot of references to ‘NAME’. For example: I know it’s something similar to an identifier but where can I find out more detail? What is NAME? Answer These are constants which represent the numeric values of leaf nodes

How can I make this grammar unambiguous?

I’m trying to write a parser for a simple language: When I run it, I get the following error: I understand that this is happening because, if we imagine that the parser was built without an error, and then wrote parser.parse(‘foo’), both arithmetic_expr and boolean_expr would be “correct” derivations. Also, as you can see I’m using LALR which is a

Advertisement