7 #define eprintf(x, y...) fprintf(stderr, x, ##y)
10 if (!strcmp(node->
tag,
"comment|regex")) {
13 if (!strcmp(node->
tag,
"linecomment|regex")) {
20 if (!strcmp(node->
tag,
"asm|regex")) {
27 if (!strcmp(node->
tag,
"stmt|>")) {
34 if (!strcmp(node->
tag,
"sigdef|>")) {
41 if (!strcmp(node->
tag,
"procedure|>")) {
54 if (strcmp(
tag,
"char")) {
59 printf(
"; CALL WITH %d ARGS\n", narg);
82 if (!strcmp(
type,
"alias")) {
84 }
else if (!strcmp(
type,
"syscall")) {
86 }
else if (!strcmp(
type,
"global")) {
87 printf(
"; TODO: global \n");
89 printf(
"; UNKNOWN EXPRESISON: NAME = '%s' ",
name);
101 char *nl = strchr(
s,
'\n');
143 " ident : /[a-zA-Z_][a-zA-Z0-9_]*/ ; \n"
144 " number : /[0-9]+/ ; \n"
145 " character : /'.'/ ; \n"
146 " string : /\"(\\\\.|[^\"])*\"/ ; \n"
148 " factor : '(' <lexp> ')' \n"
152 " | <ident> '(' <lexp>? (',' <lexp>)* ')' \n"
155 " term : <factor> (('*' | '/' | '%') <factor>)* ; \n"
156 " lexp : <term> (('+' | '-') <term>)* ; \n"
158 " stmt : '{' <stmt>* '}' \n"
159 " | \"while\" '(' <exp> ')' <stmt> \n"
160 " | \"if\" '(' <exp> ')' <stmt> \n"
161 " | <ident> '=' <lexp> ';' \n"
162 " | \"print\" '(' <lexp>? ')' ';' \n"
163 " | \"return\" <lexp>? ';' \n"
164 " | <ident> '(' (<number>|<ident>|<string>)? (',' (<string>|<number>|<ident>))* ')' ';' ; \n"
166 " exp : <lexp> '>' <lexp> \n"
167 " | <lexp> '<' <lexp> \n"
168 " | <lexp> \">=\" <lexp> \n"
169 " | <lexp> \"<=\" <lexp> \n"
170 " | <lexp> \"!=\" <lexp> \n"
171 " | <lexp> \"==\" <lexp> ; \n"
173 " vartype : (\"int\" | \"char\") ; \n"
174 " typeident : <vartype> <ident> ; \n"
175 " decls : (<typeident> ';')* ; \n"
176 " args : <typeident>? (',' <typeident>)* ; \n"
177 " body : '{' <decls> <stmt>* '}' ; \n"
178 " comment : /\\/\\*([^\\*])*\\*\\// ; \n"
179 " linecomment : /\\/\\/([^\\n])*/ ; \n"
180 " asm : /\\:([^\\n])*/ ; \n"
181 " procedure : <ident> '@' \"global\" '(' <number>? ')' <body> ; \n"
182 " cprocedure : <vartype> <ident> '(' <args> ')' <body> ; \n"
183 " sigdef : <ident> '@' <ident> '(' <number> ')' ';' ; \n"
184 " sigbody : '@' <ident> '(' <number> ')' ';' ; \n"
185 " includes : (\"#include\" <string>)* ; \n"
186 " smallc : /^/ (<comment>|<asm>|<linecomment>|<sigdef>|<sigbody>|<procedure>|<cprocedure>)* <includes> <decls> /$/ ; \n",
187 Ident, Number, Character,
String, Factor, Term, Lexp, Stmt, Exp,
188 Vartype, Typeident, Decls, Args, Body, Comment, Linecomment, Asm, Procedure, CProcedure,
189 Sigdef, Sigbody, Includes, Smallc,
NULL);
206 for (
i = 0;
i <
root->children_num;
i++) {
231 mpc_cleanup(17, Ident, Number, Character,
String, Factor, Term, Lexp, Stmt, Exp,
232 Vartype, Typeident, Decls, Args, Body, Comment, Procedure, CProcedure,
233 Sigdef, Includes, Smallc);
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
RZ_API void Ht_() free(HtName_(Ht) *ht)
static static fork const void static count static fd const char const char static newpath char char argv
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
mpc_err_t * mpca_lang(int flags, const char *language,...)
void mpc_ast_delete(mpc_ast_t *a)
int mpc_parse_pipe(const char *filename, FILE *pipe, mpc_parser_t *p, mpc_result_t *r)
void mpc_err_print(mpc_err_t *x)
void mpc_ast_print(mpc_ast_t *a)
int mpc_parse_contents(const char *filename, mpc_parser_t *p, mpc_result_t *r)
mpc_parser_t * mpc_new(const char *name)
void mpc_ast_print_to(mpc_ast_t *a, FILE *fp)
void mpc_cleanup(int n,...)
void mpc_err_delete(mpc_err_t *x)
int main(int argc, char **argv)
static int isComment(mpc_ast_t *node)
static void processNode(mpc_ast_t *node)
static int isInlineAssembly(mpc_ast_t *node)
static int isStatement(mpc_ast_t *node)
static int isSigdef(mpc_ast_t *node)
static int isProcedure(mpc_ast_t *node)
struct mpc_ast_t ** children