I am trying to write a rule in order to represent 0 or more using recursion: The rule in EBNF is the following:
translation_unit
=> external_declaration { external_declaration}
My guess is the following:
translation_unit(Xs0,Xs) :-
[external_declaration|Xs].
Also I would like to represent optionality in another rule which is the following:
declaration_specifiers_next
a. : ε
b. | declaration_specifiers
My guess would be:
declaration_specifiers_next(Xs0, Xs)
:- ε,
[declaration_specifiers|Xs]
I am also confused about the argument that we give to the title of the rule in that case: (Xs0, Xs)
What do they actually mean?