leo
leo copied to clipboard
[Bug] Discrepancy between grammar and parser for input items
🐛 Bug Report
The ABNF input grammar file defines
input-item = identifier ":" input-type "=" input-expression ";"
while the parser accepts an option const/constant/public before the identifier:
https://github.com/AleoHQ/leo/blob/4acf285c35cb51caf30dcdfa1c05132c027a44ad/compiler/parser/src/parser/input.rs#L64
I thought that it was the purpose of the section names to categorize the inputs, e.g.
[public]
x: u32 = 27u32;
y: i8 = -22i8;
[private]
z: u16 = 6000u16;
[constant]
c: field = 88field;
We need to either change the grammar or the parser.
@acoglio when I last talked with @collinc97 the way we currently have the parser where everything is in main section is correct. That being said I would be in favor of a change like this as it makes the input file cleaner IMO.
Input file sections in Leo v1.6.2 refer to transition function inputs only. const, public, private modifiers must be stated with the input variable.