leo icon indicating copy to clipboard operation
leo copied to clipboard

[Bug] Discrepancy between grammar and parser for input items

Open acoglio opened this issue 3 years ago • 1 comments

🐛 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 avatar Apr 29 '22 06:04 acoglio

@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.

gluax avatar May 03 '22 16:05 gluax

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.

collinc97 avatar Jan 05 '23 22:01 collinc97