bump
This commit is contained in:
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <tommyds/tommyhashtbl.h>
|
#include <tommyds/tommyhashtbl.h>
|
||||||
|
|
||||||
|
#define WORD_SIZE_IN_BYTES (64/8)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int size;
|
int size;
|
||||||
long value;
|
long value;
|
||||||
|
@ -91,9 +91,9 @@ u64 { return U64; }
|
|||||||
\/\/ { BEGIN IN_COMMENT; }
|
\/\/ { BEGIN IN_COMMENT; }
|
||||||
\/\* { BEGIN IN_MULTILINE_COMMENT; }
|
\/\* { BEGIN IN_MULTILINE_COMMENT; }
|
||||||
|
|
||||||
\[|\] { return yytext[0]; }
|
\[|\]|\{|\}|\+|\-|\*|\/|\%|\^|\: {
|
||||||
|
return yytext[0];
|
||||||
\+|\-|\*|\/|\%|\^|\: { return yytext[0]; }
|
}
|
||||||
|
|
||||||
fastcall { return FASTCALL; }
|
fastcall { return FASTCALL; }
|
||||||
|
|
||||||
@ -126,8 +126,13 @@ machine { BEGIN INITIAL; return END_MACHINE; }
|
|||||||
/* XXX: escapes; multiline strings will die */
|
/* XXX: escapes; multiline strings will die */
|
||||||
\" {
|
\" {
|
||||||
BEGIN INITIAL;
|
BEGIN INITIAL;
|
||||||
|
if (yyleng <= WORD_SIZE_IN_BYTES) {
|
||||||
|
memcpy(&yylval.intval, yytext, WORD_SIZE_IN_BYTES);
|
||||||
|
return LITERAL;
|
||||||
|
}
|
||||||
|
|
||||||
yylval.strval = strdup(string_literal_buffer);
|
yylval.strval = strdup(string_literal_buffer);
|
||||||
return STRING_LITERAL;
|
return ARRAY_LITERAL;
|
||||||
}
|
}
|
||||||
. {
|
. {
|
||||||
if (string_litral_buffer_size + yyleng > string_litral_buffer_capacity) {
|
if (string_litral_buffer_size + yyleng > string_litral_buffer_capacity) {
|
||||||
|
@ -45,9 +45,10 @@
|
|||||||
%token<strval> IDENTIFIER LABEL
|
%token<strval> IDENTIFIER LABEL
|
||||||
|
|
||||||
%type<intval> immediate
|
%type<intval> immediate
|
||||||
|
%type<intval> memory dereference
|
||||||
%type<intval> artimetric_block artimetric_expression artimetric_operand
|
%type<intval> artimetric_block artimetric_expression artimetric_operand
|
||||||
%token<intval> LITERAL
|
%token<intval> LITERAL
|
||||||
%token<strval> STRING_LITERAL
|
%token<strval> ARRAY_LITERAL
|
||||||
|
|
||||||
// Specifiers
|
// Specifiers
|
||||||
%token FAST
|
%token FAST
|
||||||
@ -137,11 +138,6 @@ declaration:
|
|||||||
$$.value = $5;
|
$$.value = $5;
|
||||||
add_variable($$);
|
add_variable($$);
|
||||||
}
|
}
|
||||||
| variable_specifier type IDENTIFIER '=' STRING_LITERAL {
|
|
||||||
$$.name = make_scoped_name(scope, $3);
|
|
||||||
$$.value = $5;
|
|
||||||
add_variable($$);
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
variable_specifier: %empty
|
variable_specifier: %empty
|
||||||
@ -159,10 +155,15 @@ type: S8 { $$ = S8; }
|
|||||||
;
|
;
|
||||||
|
|
||||||
immediate: LITERAL
|
immediate: LITERAL
|
||||||
| IDENTIFIER
|
| IDENTIFIER { $$ = 0; /* XXX: how the fuck do i dereference? */}
|
||||||
;
|
;
|
||||||
|
|
||||||
memory: artimetric_block
|
memory: artimetric_block
|
||||||
|
| dereference
|
||||||
|
;
|
||||||
|
|
||||||
|
dereference: '[' IDENTIFIER '+' value ']' { $$ = 0; /* XXX: how the fuck do i dereference? */ }
|
||||||
|
| '[' IDENTIFIER '-' value ']' { $$ = 0; /* XXX: how the fuck do i dereference? */ }
|
||||||
;
|
;
|
||||||
|
|
||||||
value: artimetric_block
|
value: artimetric_block
|
||||||
@ -234,7 +235,7 @@ machine: MACHINE machine_code END_MACHINE
|
|||||||
|
|
||||||
machine_code: %empty
|
machine_code: %empty
|
||||||
| LITERAL machine_code
|
| LITERAL machine_code
|
||||||
| STRING_LITERAL machine_code
|
| ARRAY_LITERAL machine_code
|
||||||
| IDENTIFIER machine_code { free($1); }
|
| IDENTIFIER machine_code { free($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -246,7 +247,6 @@ calltype: FASTCALL
|
|||||||
|
|
||||||
arguments: %empty
|
arguments: %empty
|
||||||
| IDENTIFIER arguments { free($1); }
|
| IDENTIFIER arguments { free($1); }
|
||||||
| STRING_LITERAL arguments { free($1); }
|
|
||||||
| LITERAL arguments
|
| LITERAL arguments
|
||||||
| register arguments
|
| register arguments
|
||||||
| artimetric_block arguments
|
| artimetric_block arguments
|
||||||
@ -278,7 +278,7 @@ register: RAX { $$ = R0; }
|
|||||||
| RGXMM7 { $$ = 0; }
|
| RGXMM7 { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
artimetric_block: '[' artimetric_expression ']' { $$ = $2; }
|
artimetric_block: '{' artimetric_expression '}' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
artimetric_expression: %empty { $$ = 0; }
|
artimetric_expression: %empty { $$ = 0; }
|
||||||
@ -292,7 +292,6 @@ artimetric_expression: %empty { $$ = 0; }
|
|||||||
;
|
;
|
||||||
|
|
||||||
artimetric_operand: LITERAL
|
artimetric_operand: LITERAL
|
||||||
| STRING_LITERAL
|
|
||||||
| IDENTIFIER { $$ = 0; /*XXX*/ }
|
| IDENTIFIER { $$ = 0; /*XXX*/ }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user