epi-project / brane-documentation

Repository that contains the high-level documentation of the Brane framework. Written for use with mdBook.
Apache License 2.0
2 stars 2 forks source link

Branescript attribute list definition #31

Open DanielVoogsgerd opened 2 days ago

DanielVoogsgerd commented 2 days ago

The Branescript compiler assumes that attribute lists are comma-separated. However, this is incompatible with the formal definition of the language:

      AttrList ::= IDENT LPAREN Literals RPAREN
      Literals ::= Literals Literal
                 | Literal
Lut99 commented 1 day ago

Good catch again! I'm genuinely impressed by how thorough you're looking at this! :D

Anyway yes this doesn't make sense. I tried to emulate Rust syntax here, so it's definitely with commas. Let me check the whole attribute tree to check if it makes sense with what I'm actually parsing.

Lut99 commented 1 day ago

OK, right, it was a bit simpler Rust syntax. Only the following is allowed:

#[key = value]

OR

#[name(lit1, lit2, lit3, ...)]

Note the contents of the second variant is only literals, not any expressions. Makes it easier to parse the on-attributes though xD

Lut99 commented 1 day ago

Change

Literals ::= Literals Literal

to

Literals ::= Literals COMMA Literal

and it's fixed.