1# abigen grammar 2 3## Modified BNF rules 4 5This is the grammar for abigen files. The grammar is expressed in 6a modified BNF format. 7 8A nonterminal symbol matches a sequence of other symbols, delimited by 9commas. 10``` 11nonterminal = list , of , symbols ; 12``` 13 14Some symbols are terminals, which are either in all caps or are in 15double quotes. 16``` 17another-nonterminal = THESE , ARE , TERMINALS , AND , SO , IS , "this" ; 18``` 19 20Alternation is expressed with a pipe. 21``` 22choice = this | that | the-other ; 23``` 24 25An option (zero or one) is expressed with parentheses. 26``` 27optional = ( maybe , these ) , but , definitely , these ; 28``` 29 30Repetition (zero or more) is expressed with parentheses and a star. 31``` 32zero-or-more = ( list-part )* ; 33``` 34 35## The grammar 36 37`file` is the starting symbol. 38 39``` 40file = ( declaration )* , EOF ; 41 42declaration = syscall-declaration ; 43 44syscall-declaration = syscall IDENTIFIER attribute-list "(" parameter-list ")" 45 ( "returns" "(" type ( "," parameter-list ) ")" ) 46 47parameter-list = parameter | parameter "," parameter-list 48 49parameter = IDENTIFIER ":" type attribute-list ( inout ) 50 51attribute-list = ( attribute )* 52 53attribute = IDENTIFIER 54 55type = IDENTIFIER 56 57inout = "IN" | "OUT" | "INOUT" 58``` 59