diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-13 21:05:34 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-13 21:05:34 -0400 |
commit | 39ecba0032be794a1f4d66f61e09e4910270330f (patch) | |
tree | 9b68f25a597891afce13825328e837da168dfada /as/as.y |
migrate to gitlab
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 +; |