-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsquawk.y
81 lines (46 loc) · 1.27 KB
/
squawk.y
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
%{
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <gc.h>
#include <unistr.h>
#include "machine.h"
#define BB_BOUNDARY (last_compiled = NULL, block_insert(vmcodep))
extern uint8_t* gc_strndup(uint8_t* str, size_t len); extern uint8_t* gc_strncat(uint8_t* str, uint8_t* cat, size_t len);
Label *vm_prim;
Inst *vmcodep;
int vm_debug;
#include "squawk-gen.i"
extern void yyerror(char *s);
extern int yylex(void);
int locals = 0;
int nonparams = 0;
%}
%union {
uint8_t* str;
uint8_t* regex;
uint8_t* ident;
int64_t intg;
long double fltn;
int fieldn;
Inst* instp;
}
%token Begin End
%token Break Continue Delete Do Else
%token Exit For Function If In
%token Next Print Printf Return While
%token BUILTIN_FUNC_NAME
%token ADD_ASSIGN SUB_ASSIGN MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN POW_ASSIGN
%token STRING REGEX
%token INTEGER FLOATNUM
%token FIELD
%token OR AND NO_MATCH EQ LE GE NE INCR DECR APPEND
%token LBRACE RBRACE LPAREN RPAREN LBRACK RBRACK ',' ';' NEWLINE
%token '+' '-' '*' '%' '^' '!' '>' '<' '|' '?' ':' '˜' '$' '='
%type <str> IDENT
%type <regex> REGEX
%type <intg> INTEGER
%type <fltn> FLOATNUM
%type <fieldn> FIELD
%start awkprog
%%