On Fri, Oct 29, 2021 at 12:53 PM Kamil Ziemian <kziemian...@gmail.com> wrote:
>
> From what I understand about EBNF production_name should be defined using 
> EBNF notation in manner like below.
>
> production_name = something1 | something2
>
> But I don't see such definition in Spec.

Because production_name is a terminal symbol of the EBNF grammar per se.

""""
Lower-case production names are used to identify lexical tokens.
Non-terminals are in CamelCase.
""""

src: https://golang.org/ref/spec#Notation

The above link defines a meta-grammar, ie. a grammar of the EBNF
grammar in which the actual Go EBNF grammar is later on defined. In
the Go case the terminals are really defined, like here
https://golang.org/ref/spec#Letters_and_digits.

The EBNF grammar per se is outlined only loosely and is strictly not
complete in this case, so you're right. The reader is expected to
assume "usual" grammar of an identifier, like "a letter followed by 1
or more letters or digits", for example. The "real" definition of EBNF
can be found for example here:
https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form. It
seems too long to include in the Go specs, moreover I think it even
differs in some details.

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA40n-V%2BRV3SV1uJPTMSujM59o%3Dq-y5Y9qe%2BYrV36xjjk9G99w%40mail.gmail.com.

Reply via email to