summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/bit.y15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/bit.y b/bin/bit.y
index 7a7d37ed..ec3892fd 100644
--- a/bin/bit.y
+++ b/bin/bit.y
@@ -28,14 +28,16 @@
 
 #define YYSTYPE uint64_t
 
-static void yyerror(const char *str);
 static int yylex(void);
+static void yyerror(const char *str);
 static void print(uint64_t val);
 
 static uint64_t vars[128];
 
 %}
 
+%token Int Var
+
 %left '$'
 %right '='
 %left '|'
@@ -47,15 +49,12 @@ static uint64_t vars[128];
 %right '~'
 %left 'K' 'M' 'G' 'T'
 
-%token Int Var
-
 %%
 
 stmt:
 	| stmt expr '\n' { print(vars['_'] = $2); printf("\n"); }
 	| stmt expr ',' { print(vars['_'] = $2); }
 	| stmt '\n'
-	| stmt ','
 	;
 
 expr:
@@ -87,10 +86,6 @@ expr:
 
 %%
 
-static void yyerror(const char *str) {
-	warnx("%s", str);
-}
-
 static int lexInt(uint64_t base) {
 	yylval = 0;
 	for (char ch; EOF != (ch = getchar());) {
@@ -159,6 +154,10 @@ static int yylex(void) {
 	}
 }
 
+static void yyerror(const char *str) {
+	warnx("%s", str);
+}
+
 static const char *Codes[128] = {
 	"NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL",
 	"BS",  "HT",  "NL",  "VT",  "NP",  "CR",  "SO",  "SI",