diff options
Diffstat (limited to 'as/as.y')
-rw-r--r-- | as/as.y | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -0,0 +1,36 @@ +%{ +#include <inttypes.h> +%} + +%union { + char *s; + uintmax_t n; +}; + +%token<n> NUMBER +%token<s> TOKEN +%token NEWLINE + +%% + +program + : /* empty */ + | instruction NEWLINE +; + +instruction + : bare_instruction + | TOKEN ':' bare_instruction +; + +bare_instruction + : TOKEN + | TOKEN operand + | TOKEN operand ',' operand + | TOKEN operand ',' operand ',' operand +; + +operand + : TOKEN + | NUMBER +; |