Difference between revisions of "GenAsm (language)"
From Mill Computing Wiki
m | Will Edwards (Talk | contribs) m (fixed link) | ||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | The [[genAsm]] assembly language is a low-level [https://en.wikipedia.org/wiki/Dataflow_programming | + | The [[genAsm]] assembly language is a low-level [https://en.wikipedia.org/wiki/Dataflow_programming dataflow language] for writing programs to be executed on the Mill processors. The language is accepted by the [[genAsm (assembler)|genAsm assembler]], which create ELF files suitable as input to the [[prelinker]] or [[specializer]]. The assembler is intended for use when high-level language compilers are unable to provide a desired access to Mill hardware facilities. |
Syntax in [https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form EBNF]: | Syntax in [https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form EBNF]: | ||
Line 12: | Line 12: | ||
− | program ::= "module", moduleId, | + | program ::= "module", moduleId, serial; |
− | serial ::= [expDef, {";", expDef | + | serial ::= [expDef], {";", [expDef]}; |
− | expDef ::= expression | definition; | + | expDef ::= expression | |
− | definition ::= functionDef; | + | definition | |
+ | join, [expDef]; | ||
+ | definition ::= functionDef | labelDef; | ||
functionDef ::= ["inline"], "func", identifier, formals, [results], funcBody; | functionDef ::= ["inline"], "func", identifier, formals, [results], funcBody; | ||
funcBody ::= ":", expression | "outcall" | "forward"; | funcBody ::= ":", expression | "outcall" | "forward"; | ||
Line 23: | Line 25: | ||
results ::= widthPack; | results ::= widthPack; | ||
widthPack ::= "{", [widthTag, {",", widthTag}], "}"; | widthPack ::= "{", [widthTag, {",", widthTag}], "}"; | ||
− | expression ::= | + | labelDef ::= "label", [widthPack], identifier, "forward"; |
+ | expression ::= secondary | | ||
expression, binding | | expression, binding | | ||
expression, gang, [secondary] | | expression, gang, [secondary] | | ||
− | expression, ["inline"], funcId, [secondary] | + | expression, ["inline"], funcId, [secondary] | |
+ | expression, join | | ||
expression, "?", expression, ":", expression; | expression, "?", expression, ":", expression; | ||
secondary ::= primary | | secondary ::= primary | | ||
− | secondary, "(", [expression, {",", expression}], ")" | + | secondary, "(", [expression, {",", expression}], ")" | |
secondary, widthPack; | secondary, widthPack; | ||
primary ::= widthTag | | primary ::= widthTag | | ||
− | [widthTag, ":"] number | | + | [widthTag, ":"], number | |
boundId | | boundId | | ||
+ | ebbId | | ||
["inline"], funcId | | ["inline"], funcId | | ||
gang | | gang | | ||
− | "(" expression ")" | | + | "(", expression, ")" | |
"begin", serial, "end" | | "begin", serial, "end" | | ||
ifClause; | ifClause; | ||
− | binding ::= "-:" identifier | | + | binding ::= "-:", identifier | |
"-:", idenPack; | "-:", idenPack; | ||
idenPack ::= "{", identifier, {",", identifier}, "}"; | idenPack ::= "{", identifier, {",", identifier}, "}"; | ||
− | gang ::= opId ["." opId]; | + | gang ::= opId, [".", opId]; |
opId ::= identifier; | opId ::= identifier; | ||
+ | ebbId ::= identifier; | ||
+ | join ::= ebbId, ":"; | ||
ifClause ::= "if", predPart, thenPart, {elifPart}, [elsePart], "fi"; | ifClause ::= "if", predPart, thenPart, {elifPart}, [elsePart], "fi"; | ||
predPart ::= serial; | predPart ::= serial; | ||
Line 50: | Line 57: | ||
elsePart ::= "else", serial; | elsePart ::= "else", serial; | ||
boundId ::= identifier; | boundId ::= identifier; | ||
− | + | funcId ::= identifier; | |
− | funcId ::= | + | |
− | + | ||
moduleId ::= identifier; | moduleId ::= identifier; | ||
− | identifier ::= alpha, {alnum}; | + | identifier ::= [qualification], name; |
+ | qualification ::= [qualification], name, "::"; | ||
+ | name ::= alpha, {alnum}; | ||
alnum ::= decDigit | alpha; | alnum ::= decDigit | alpha; | ||
alpha ::= "_" | <"a"-"z"> | <"A"-"Z">; | alpha ::= "_" | <"a"-"z"> | <"A"-"Z">; | ||
decDigit ::= <"0"-"9">; | decDigit ::= <"0"-"9">; | ||
number ::= decimal | hexadecimal | float; | number ::= decimal | hexadecimal | float; | ||
− | decimal ::= | + | decimal ::= decDigit, { decDigit }; |
− | hexadecimal ::= hexBase, hexDigit, { hexDigit } | + | hexadecimal ::= hexBase, hexDigit, { hexDigit }; |
− | hexBase ::= "0x" | "0X" | + | hexBase ::= "0x" | "0X"; |
− | hexDigit ::= decDigit | <"a"-"f"> | <"A"-"F"> | + | hexDigit ::= decDigit | <"a"-"f"> | <"A"-"F">; |
float ::= decimal, ".", [decimal], [exponent] | | float ::= decimal, ".", [decimal], [exponent] | | ||
− | decimal, ["." [decimal]], exponent | + | decimal, [".", [decimal]], exponent; |
exponent ::= "e", [sign], decimal | | exponent ::= "e", [sign], decimal | | ||
− | "E", [sign], decimal | + | "E", [sign], decimal; |
− | sign ::= "+" | "-" | + | sign ::= "+" | "-"; |
comment ::= "//", {<char>}, <EOL> | "/*", {<char>}, "*/"; | comment ::= "//", {<char>}, <EOL> | "/*", {<char>}, "*/"; |
Latest revision as of 22:19, 12 January 2015
The genAsm assembly language is a low-level dataflow language for writing programs to be executed on the Mill processors. The language is accepted by the genAsm assembler, which create ELF files suitable as input to the prelinker or specializer. The assembler is intended for use when high-level language compilers are unable to provide a desired access to Mill hardware facilities.
Syntax in EBNF:
" ... " terminal keyword or symbol ::= is defined as | alternatives [ ... ] option (zero or one times { ... } repetition (zero or more times) , sequence (in order left-to-right) ; end of definition
program ::= "module", moduleId, serial; serial ::= [expDef], {";", [expDef]}; expDef ::= expression | definition | join, [expDef]; definition ::= functionDef | labelDef; functionDef ::= ["inline"], "func", identifier, formals, [results], funcBody; funcBody ::= ":", expression | "outcall" | "forward"; formals ::= "(", [formal, {",", formal}], ")"; formal ::= widthTag, identifier; widthTag ::= "b" | "h" | "w" | "d" | "q" | "bv" | "hv" | "wv" | "dv" | "qv"; results ::= widthPack; widthPack ::= "{", [widthTag, {",", widthTag}], "}"; labelDef ::= "label", [widthPack], identifier, "forward"; expression ::= secondary | expression, binding | expression, gang, [secondary] | expression, ["inline"], funcId, [secondary] | expression, join | expression, "?", expression, ":", expression; secondary ::= primary | secondary, "(", [expression, {",", expression}], ")" | secondary, widthPack; primary ::= widthTag | [widthTag, ":"], number | boundId | ebbId | ["inline"], funcId | gang | "(", expression, ")" | "begin", serial, "end" | ifClause; binding ::= "-:", identifier | "-:", idenPack; idenPack ::= "{", identifier, {",", identifier}, "}"; gang ::= opId, [".", opId]; opId ::= identifier; ebbId ::= identifier; join ::= ebbId, ":"; ifClause ::= "if", predPart, thenPart, {elifPart}, [elsePart], "fi"; predPart ::= serial; thenPart ::= "then", serial; elifPart ::= "elif", serial; elsePart ::= "else", serial; boundId ::= identifier; funcId ::= identifier; moduleId ::= identifier; identifier ::= [qualification], name; qualification ::= [qualification], name, "::"; name ::= alpha, {alnum}; alnum ::= decDigit | alpha; alpha ::= "_" | <"a"-"z"> | <"A"-"Z">; decDigit ::= <"0"-"9">; number ::= decimal | hexadecimal | float; decimal ::= decDigit, { decDigit }; hexadecimal ::= hexBase, hexDigit, { hexDigit }; hexBase ::= "0x" | "0X"; hexDigit ::= decDigit | <"a"-"f"> | <"A"-"F">; float ::= decimal, ".", [decimal], [exponent] | decimal, [".", [decimal]], exponent; exponent ::= "e", [sign], decimal | "E", [sign], decimal; sign ::= "+" | "-"; comment ::= "//", {<char>}, <EOL> | "/*", {<char>}, "*/";