diff --git a/ccmeta.leg b/ccmeta.leg index c869455..55084ef 100644 --- a/ccmeta.leg +++ b/ccmeta.leg @@ -104,8 +104,22 @@ jb_record *jbs= NULL; // this is the global scope oop globals= 0; + oop program= 0; -oop prop_enums= 0; + +oop prog_last= 0; + +oop prog_objects= 0; +oop objects_elements= 0; +oop objects_last= 0; + +oop prog_enums= 0; +oop prog_structs= 0; +oop prog_unions= 0; + +oop enum_last= 0; +oop struct_last= 0; +oop union_last= 0; #define DO_SYMBOLS() \ DO_PROTOS() _DO(__proto__) _DO(__name__) _DO(__default__) _DO(__arguments__) \ @@ -844,6 +858,14 @@ oop new_C_structSpec(oop structTok, oop attributeSpecifier1, oop id, oop leftCur map_set(object, declarationL_symbol,declarationList); map_set(object, rightCurly_symbol, rightCurly); map_set(object, attribute2_symbol, attributeSpecifier2); + if (strcmp(get(map_get(structTok, text_symbol), String, value), "union") == 0) { + map_set(prog_unions, map_get(id, identifier_symbol), object); + map_set(prog_unions, intern("last" ), object); + } else { + map_set(prog_structs, map_get(id, identifier_symbol), object); + map_set(prog_structs, intern("last" ), object); + } + map_set(program, intern("last"), object); return object; } @@ -863,8 +885,10 @@ oop new_C_enumSpec(oop enumTok, oop id, oop leftCurly, oop enumeratorList, oop r map_set(object, enumList_symbol, enumeratorList); map_set(object, rightCurly_symbol, rightCurly); if (id != null) { - map_set(prop_enums, map_get(id, identifier_symbol), object); + map_set(prog_enums, map_get(id, identifier_symbol), object); } + map_set(prog_enums, intern("last"), object); + map_set(program, intern("last"), object); return object; } @@ -1606,7 +1630,7 @@ constantExpression = conditionalExpression # 6.7 -declaration = @{ C_declarationBegin() } +declaration = @{ C_declarationBegin() } ( s:declarationSpecifiers d:initDeclaratorListOpt t:SEMI { $$= new_C_declaration(s, d, t) } @@ -1616,7 +1640,7 @@ declaration = @{ C_declarationBegin() } declarationSpecifiers = @{ int specified= 0 } { listBegin() } ( s:storageClassSpecifier { listAppend(s) } - | s:typeSpecifier @{ specified++ } { listAppend(s) } + | s:typeSpecifier @{ specified++ } { listAppend(s) } # Any list of specifiers and qualifiers at the start # of a declaration may contain attribute specifiers | s:attributeSpecifier &{gnu} { listAppend(s) } @@ -1638,7 +1662,7 @@ initDeclarator = d:declarator # 6.7.1 -storageClassSpecifier = TYPEDEF @{ declarationTypedef() } +storageClassSpecifier = TYPEDEF @{ declarationTypedef() } | AUTO | parameterStorageClassSpecifier | functionStorageClassSpecifier @@ -1930,9 +1954,9 @@ jumpStatement = g:GOTO i:id t:SEMI { $$= new_C_goto(g, ## translationUnit = externalDeclaration+ externalDeclaration = { $$= newComment(yytext); } - | ( SEMI &{gnu} + | ( SEMI &{gnu} | declaration - | functionDefinition + | functionDefinition | &. &{ errmsg= "declaration expected" } error ) @@ -2165,21 +2189,17 @@ _FLOAT128 = '_Float128' !IDREST &{gnu} { $$= newToken("_Float128" # input buffer from moving past it before redirecting input from the imported file metaCatch = META_AT ( META_IMPORT s:META_STRING ";" { inputStackPush(get(s, String, value)) ; $$= 0 } - | m:mvalue { $$= m } + | m:mvalue { map_append(outputProgram, m); $$= null } | META_LCB s:mstmts { map_append(outputProgram, s); $$= null } ) -mvalue = i:META_IDENT { i= newGetVariable(i) } - ( a:meta_argumentList { i = (null != getSyntax(1, i)) ? apply(globals, globals, getSyntax(1, i), a, i) : newCall(i, a) } )? - { $$= eval(globals, i)} - | META_LPAREN ( i:MO_OPERATION - | i:meta_exp - ) META_RPAREN { $$= eval(globals, i) } +mvalue = ( i:META_IDENT { i= newGetVariable(i) } + ( a:meta_argumentList { i = (null != getSyntax(1, i)) ? apply(globals, globals, getSyntax(1, i), a, i) : newCall(i, a) } )? + | META_LPAREN ( i:meta_exp ) META_RPAREN + ) { $$= eval(globals, i) } -mstmts = ( s:eval_stmt )* ( META_NIL META_SEMICOLON META_RCB { $$= null } - | META_RCB { $$= s } - ) +mstmts = ( s:eval_stmt )* META_RCB { $$= s } eval_stmt = s:meta_stmt { $$= eval(globals, s) } @@ -2213,6 +2233,7 @@ meta_exp = META_VAR l:meta_ident META_ASSIGN e:meta_exp # | META_SYNTAX p:meta_paramList q:META_IDENT e:meta_block { $$= (map_append(p, q), newFunc(null, p, e, makeInteger(2))) } # | META_SYNTAX l:META_IDENT p:meta_paramList e:meta_block { $$= newFunc(l, p, e, makeInteger(1)) } # | META_SYNTAX p:meta_paramList e:meta_block { $$= newFunc(null, p, e, makeInteger(1)) } + | m:MO_OPERATION { $$= m } | l:META_IDENT o:meta_assignOp e:meta_exp { $$= newAssign(Assign_proto, l, o, e) } | l:meta_postfix META_DOT i:META_IDENT o:meta_assignOp e:meta_exp { $$= newSetMap(SetMember_proto, l, i, o, e) } | l:meta_postfix META_LBRAC i:meta_exp META_RBRAC o:meta_assignOp e:meta_exp { $$= newSetMap(SetIndex_proto, l, i, o, e) } @@ -2308,7 +2329,6 @@ meta_prefix = META_PLUS n:meta_prefix { $$= n } | META_PLING n:meta_prefix { $$= newUnary(Not_proto, n) } | META_PLUSPLUS n:meta_prefix { $$= newPreIncrement(n) } | META_MINUSMINUS n:meta_prefix { $$= newPreDecrement(n) } - | m:MO_OPERATION { $$= m } # | META_BACKTICK n:meta_prefix { $$= newUnary(Quasiquote_proto, n) } # | META_AT n:meta_prefix { $$= newUnary(Unquote_proto, n) } | n:meta_postfix { $$= n } @@ -2404,6 +2424,8 @@ MO_OPERATION = META_BACKTICK ( MO_INITIALIZER i:initializer { $$= newUn | MO_INTEGER i:integerConstant { $$= newUnary(Quote_proto ,i) } | MO_DECLARATION i:declaration { $$= newUnary(Quote_proto ,i) } | MO_STRING i:stringLiteral { $$= newUnary(Quote_proto ,i) } + | MO_FUN i:functionDefinition { $$= newUnary(Quote_proto ,i) } + | MO_ED i:externalDeclaration{ $$= newUnary(Quote_proto ,i) } ) MO_INITIALIZER = 'initializer' ![(a-zA-Z0-9_] -- @@ -2412,6 +2434,8 @@ MO_STATEMENT = 'statement' ![(a-zA-Z0-9_] -- MO_INTEGER = 'integer' ![(a-zA-Z0-9_] -- MO_DECLARATION = 'declaration' ![(a-zA-Z0-9_] -- MO_STRING = 'string' ![(a-zA-Z0-9_] -- +MO_FUN = 'fun' ![(a-zA-Z0-9_] -- +MO_ED = 'ed' ![(a-zA-Z0-9_] -- #--------------------------------------------- Meta rules ----------------------------------------------# @@ -2429,7 +2453,7 @@ META_IN = 'in' ![a-zA-Z0-9_] -- META_WHILE = 'while' ![a-zA-Z0-9_] -- META_IF = 'if' ![a-zA-Z0-9_] -- META_ELSE = 'else' ![a-zA-Z0-9_] -- -META_NULL = 'null' ![a-zA-Z0-9_] -- +META_NULL = ('null'|'nil') ![a-zA-Z0-9_] -- META_RETURN = 'return' ![a-zA-Z0-9_] -- META_BREAK = 'break' ![a-zA-Z0-9_] -- META_CONTINUE = 'continue' ![a-zA-Z0-9_] -- @@ -3453,6 +3477,15 @@ oop prim_keys(oop scope, oop params) return null; } +oop prim_all_keys(oop scope, oop params) +{ + if (map_hasIntegerKey(params, 0)) { + oop arg= get(params, Map, elements)[0].value; + if (is(Map, arg)) return map_allKeys(arg); + } + return null; +} + oop prim_values(oop scope, oop params) { if (map_hasIntegerKey(params, 0)) { @@ -3504,7 +3537,7 @@ oop prim_print(oop scope, oop params) } return params; } - +//TRY oop evalArgs(oop scope, oop args) { int i = 0; @@ -4634,6 +4667,7 @@ int main(int argc, char **argv) map_set(globals, intern("exit" ), makeFunction(prim_exit, intern("exit" ), null, null, globals, null)); map_set(globals, intern("keys" ), makeFunction(prim_keys, intern("keys" ), null, null, globals, null)); + map_set(globals, intern("allKeys" ), makeFunction(prim_all_keys, intern("allKeys" ), null, null, globals, null)); map_set(globals, intern("values" ), makeFunction(prim_values, intern("values" ), null, null, globals, null)); map_set(globals, intern("length" ), makeFunction(prim_length, intern("length" ), null, null, globals, null)); map_set(globals, intern("print" ), makeFunction(prim_print, intern("print" ), null, null, globals, null)); @@ -4644,7 +4678,7 @@ int main(int argc, char **argv) map_set(globals, intern("microseconds"), makeFunction(prim_microseconds, intern("microseconds"), null, null, globals, null)); map_set(globals, intern("string" ), makeFunction(prim_String , intern("string" ), null, null, globals, null)); - map_set(globals, intern("scope"), makeFunction(prim_scope, intern("scope"), null, null, globals, null)); + map_set(globals, intern("scope" ), makeFunction(prim_scope, intern("scope" ), null, null, globals, null)); #define _DO(NAME) NAME##_symbol=intern(#NAME); DO_SYMBOLS() @@ -4668,10 +4702,28 @@ int main(int argc, char **argv) DO_PROTOS() #undef _DO - program = makeMap(); - prop_enums = makeMap(); - map_set(program, intern("enums"), prop_enums); - map_set(globals, intern("program"), program); + program = makeMap(); + prog_enums = makeMap(); + prog_structs = makeMap(); + prog_unions = makeMap(); + prog_last = makeMap(); + enum_last = makeMap(); + struct_last = makeMap(); + union_last = makeMap(); + prog_objects = makeMap(); + objects_elements = makeMap(); + objects_last = makeMap(); + + map_set(prog_enums , intern("last" ), enum_last ); + map_set(prog_structs , intern("last" ), struct_last ); + map_set(prog_unions , intern("last" ), union_last ); + map_set(prog_objects , intern("elements" ), objects_elements ); + map_set(prog_objects , intern("last" ), objects_last ); + map_set(program , intern("structs" ), prog_structs ); + map_set(program , intern("unions" ), prog_unions ); + map_set(program , intern("enums" ), prog_enums ); + map_set(program , intern("objects" ), prog_objects ); + map_set(globals , intern("program" ), program ); fixScope(globals); diff --git a/fake-static-classes.mc b/fake-static-classes.mc deleted file mode 100644 index 2b6ff01..0000000 --- a/fake-static-classes.mc +++ /dev/null @@ -1,33 +0,0 @@ -@(import("boot.mc")) - -@{ - - initClass(class) { - out = {}; - if (class == null) { - out.values = {}; - out.functions = {}; - } else { - out = {values: clone(class.values), functions: clone(class.functions)}; - - } - out; - } - - new(class, param) { - k = 0; - out = initClass(); - for (i in class.values) { - out.values[i] = clone(param[i]); - k++; - } - for (i in class) { - if (i != keys(class)[0]) { - out[i] = clone(class[i]); - } - } - return out; - } - - nil; -} \ No newline at end of file diff --git a/boot.mc b/parsimonyLibrary/boot.mc similarity index 51% rename from boot.mc rename to parsimonyLibrary/boot.mc index ab62dac..b415158 100644 --- a/boot.mc +++ b/parsimonyLibrary/boot.mc @@ -1,4 +1,27 @@ @{ + println(x) { print(x, "\n"); } + + treeCopy(x) { + l = {}; + k = allKeys(x); + if (k == null) { + return clone(x); + } else { + for (i in k) { + l[k[i]] = clone(treeCopy(x[k[i]])); + } + return clone(l); + } + } + + getId(x) { { identifier: x, __proto__: C_id }; } + + getEnum(x) { { attributeL: null, expression: null, name: getId(x), __proto__: C_enum }; } + + getComma() { { text: ",", comment: { text : " ", __proto__: Comment }, __proto__: Token }; } + + getComment(x) { { text : x, __proto__: Comment }; } + append(s, e) { s[length(s)] = e; } @@ -19,6 +42,8 @@ out; } + notToken(x) { x.__proto__ != Token } + select(f, s) { out = {}; for (i in s) { diff --git a/parsimonyLibrary/fake-static-classes.mc b/parsimonyLibrary/fake-static-classes.mc new file mode 100644 index 0000000..a9fb08b --- /dev/null +++ b/parsimonyLibrary/fake-static-classes.mc @@ -0,0 +1,167 @@ +@(import("parsimonyLibrary/boot.mc")) + +@{ + + checkIdorDecl(x) { + (x.identifier == null) ? x.declarators.identifier : x.identifier; + } + + checkIdorText(x) { + (x.identifier == null) ? x.text : x.identifier; + } + + object(x) { + x == null ? x = "oop" : x; + program.objects.elements[length(program.objects.elements)] = x; + program.objects.last = x; + l = {}; + enum = `declaration typedef enum {_} type_t;; + enum.semicolon.comment = getComment("\n"); + append(l, enum); + obj = `declaration union object;; + obj.semicolon.comment = getComment("\n"); + append(l, treeCopy(obj)); + type_obj = `declaration typedef union object *oop;; + type_obj.declarators[0].declarators.identifier = clone(x); + type_obj.semicolon.comment = getComment("\n"); + append(l, treeCopy(type_obj)); + l; + } + + addObject() { + enum = treeCopy(getEnum(program.last.name.identifier)); + l = length(program.enums.last.enumList); + if (string(program.enums.last.enumList[0].name.identifier) == "_" && l == 1) { + program.enums.last.enumList[0] = enum; + } else { + append(program.enums.last.enumList, getComma()); + append(program.enums.last.enumList, enum); + } + for (i=length(program.last.declarationL); i>0; i--) { + program.last.declarationL[i] = program.last.declarationL[i-1]; + }; + newType = `declaration type_t type;; + newType.semicolon.comment = getComment("\n "); + program.last.declarationL[0] = treeCopy(newType); + nil; + } + + getObjectMacro() { + macro = `ed #define get(PTR, TYPE, FIELD) (_checkType(PTR, TYPE, __FILE__, __LINE__)->TYPE.FIELD) +; + macro; + } + + setObjectMacro() { + macro = `ed #define set(PTR, TYPE, FIELD, VALUE) (_checkType(PTR, TYPE, __FILE__, __LINE__)->TYPE.FIELD = VALUE) +; + macro; + } + + getGeneralObject(x) { + func = `fun int getfoo(int obj) { + if (!isFoo(obj)) { + fprintf(stderr, "\ngetFoo call on non-foo\n"); + exit(1); + } + return get(obj, foo, foo); +} +; + id = program.structs[x].declarationL[1].specifiers[0].identifier; + star = program.structs[x].declarationL[1].declarators[0].declarators.star; + if (id != null) { + program.structs[x].declarationL[1].specifiers[0].text = program.structs[x].declarationL[1].specifiers[0].identifier + } + if (star != null) { + func.specifiers[0].text = string(checkIdorText(program.structs[x].declarationL[1].specifiers[0])) + " *"; + func.specifiers[0].comment = ""; + } else { + func.specifiers[0].text = string(checkIdorText(program.structs[x].declarationL[1].specifiers[0])); + } + func.declarators.declarators.identifier = "get" + string(x); + func.compoundS.expression[0].condition.expression.declarators.identifier = "is" + string(x); + func.compoundS.expression[0].consequent.expression[0].expression.paramTypeL[2].text[0].value = "\"\\nget" + string(x) + " call on non-" + string(x) + "\\n\""; + func.compoundS.expression[1].expression.paramTypeL[2].identifier = string(x); + func.compoundS.expression[1].expression.paramTypeL[4].identifier = checkIdorDecl(program.structs[x].declarationL[length(program.structs[x].declarationL)-1].declarators[0].declarators); + func.declarators.paramTypeL[0].specifiers[0].text = program.objects.last; + treeCopy(func); + } + +// makeGeneralObject(x) { +// func = `fun int makeString(int value) +// { +// oop newString = malloc(sizeof(struct String)); +// newString->type = String; +// } +// ; +// func.declarators.declarators.identifier = "make" + string(x); +// func.specifiers[0].text = program.objects.last; +// star = program.structs[x].declarationL[1].declarators[0].declarators.star; +// if (star != null) { +// func.declarators.paramTypeL[0].specifiers[0].text = string(checkIdorText(program.structs[x].declarationL[1].specifiers[0])) + " *"; +// func.declarators.paramTypeL[0].specifiers[0].comment = ""; +// } else { +// func.declarators.paramTypeL[0].specifiers[0].text = string(checkIdorText(program.structs[x].declarationL[1].specifiers[0])); +// } +// func.compoundS.expression[0].declarators[0].lhs.identifier = "new" + string(x); +// func.compoundS.expression[0].declarators[0].rhs.paramTypeL[0].typeName.specifiers[0].name.identifier = string(x); +// func.compoundS.expression[1].expression.rhs.identifier = string(x); +// func.compoundS.expression[1].expression.lhs.lhs.identifier = "new" + string(x); + +// for (i in program.structs[x].declarationL) { +// if (i == 0) { continue; } +// println(program.structs[x].declarationL[i]); +// } +// // println(func.compoundS.expression[1]); +// treeCopy(func); +// } + + + endObject() { + l = {}; + objectUnion = `declaration union object { type_t type; };; + objectUnion.semicolon.comment = getComment("\n"); + obj = select(notToken, program.enums.last.enumList); + elt = treeCopy(`declaration struct nil nil;); + for (i in obj) { + len = length(objectUnion.specifiers[0].declarationL); + elt.specifiers[0].name.identifier = elt.declarators[0].identifier = obj[i].name.identifier; + objectUnion.specifiers[0].declarationL[len] = treeCopy(elt); + objectUnion.specifiers[0].declarationL[len].semicolon.comment = getComment(" "); + } + append(l, objectUnion); + isDef = `declaration int is(type_t type, int obj);; + isDef.declarators[0].paramTypeL[2].specifiers[0].text = program.objects.last; + isDef.semicolon.comment = getComment("\n"); + append(l, isDef); + func = `fun int isFoo(int obj) { return is(foo, obj); }; + func.declarators.paramTypeL[0].specifiers[0].text = program.objects.last; + func.compoundS.rightCurly.comment = getComment("\n"); + for (i in obj) { + func.declarators.declarators.identifier = "is" + string(obj[i].name.identifier); + func.compoundS.expression[0].expression.paramTypeL[0].identifier = obj[i].name.identifier; + append(l, treeCopy(func)); + } + func = `fun type_t getType(int ptr) { assert(ptr); return ptr->type; }; + func.declarators.paramTypeL[0].specifiers[0].text = program.objects.last; + func.compoundS.rightCurly.comment = getComment("\n"); + append(l, treeCopy(func)); + func = `fun int is(type_t type, int obj) { return type == getType(obj); }; + func.declarators.paramTypeL[2].specifiers[0].text = program.objects.last; + func.compoundS.rightCurly.comment = getComment("\n"); + append(l, treeCopy(func)); + append(l, treeCopy(getObjectMacro())); + append(l, treeCopy(setObjectMacro())); + for (i in program.unions.last.declarationL) { + if (i == 0) { continue; } + func = getGeneralObject(program.unions.last.declarationL[i].specifiers[0].name.identifier); + append(l, func); + // func = makeGeneralObject(program.unions.last.declarationL[i].specifiers[0].name.identifier); + // append(l, func); + } + l; + } + + nil; +} + diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..09190fc --- /dev/null +++ b/test.txt @@ -0,0 +1,1182 @@ +{ +| compoundS: +| | leftCurly: +| | | text: {, +| | | comment: +| | | | text: + , +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | rightCurly: +| | | text: }, +| | | comment: +| | | | text: +, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | __file__: parsimonyLibrary/fake-static-classes.mc, +| | __line__: 63, +| | expression: +| | | 0: +| | | | declarators: +| | | | | 0: +| | | | | | binary: +| | | | | | | text: =, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | paramTypeL: +| | | | | | | | 0: +| | | | | | | | | sizeOfTok: +| | | | | | | | | | text: sizeof, +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: Token, +| | | | | | | | | typeName: +| | | | | | | | | | declarators: null, +| | | | | | | | | | specifiers: +| | | | | | | | | | | 0: +| | | | | | | | | | | | structTok: +| | | | | | | | | | | | | text: struct, +| | | | | | | | | | | | | comment: +| | | | | | | | | | | | | | text: , +| | | | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | | | __name__: Comment, +| | | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | | __name__: Token, +| | | | | | | | | | | | attribute2: null, +| | | | | | | | | | | | attribute1: null, +| | | | | | | | | | | | declarationL: null, +| | | | | | | | | | | | leftCurly: null, +| | | | | | | | | | | | rightCurly: null, +| | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | name: +| | | | | | | | | | | | | identifier: String, +| | | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | | __name__: C_id, +| | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | __name__: C_structSpec, +| | | | | | | | | | semicolon: null, +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: C_declaration, +| | | | | | | | | rparen: +| | | | | | | | | | text: ), +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: Token, +| | | | | | | | | lparen: +| | | | | | | | | | text: (, +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: Token, +| | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | __line__: 63, +| | | | | | | | | __proto__: +| | | | | | | | | | __name__: C_sizeOf, +| | | | | | | declarators: +| | | | | | | | identifier: malloc, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | rparen: +| | | | | | | | text: ), +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | lparen: +| | | | | | | | text: (, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_call, +| | | | | | lhs: +| | | | | | | identifier: obj, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | specifiers: +| | | | | 0: +| | | | | | identifier: oop, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_id, +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: C_declaration, +| | | 1: +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | binary: +| | | | | | text: =, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | rhs: +| | | | | | identifier: String, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_id, +| | | | | lhs: +| | | | | | binary: +| | | | | | | text: ->, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | identifier: type, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | lhs: +| | | | | | | identifier: obj, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | | __proto__: +| | | | | | __name__: C_binary, +| | | | __proto__: +| | | | | __name__: C_exprStatement, +| | | 2: +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | binary: +| | | | | | text: =, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | rhs: +| | | | | | paramTypeL: +| | | | | | | 0: +| | | | | | | | identifier: value, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | declarators: +| | | | | | | identifier: strdup, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | rparen: +| | | | | | | text: ), +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | lparen: +| | | | | | | text: (, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_call, +| | | | | lhs: +| | | | | | binary: +| | | | | | | text: ., +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | identifier: value, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | lhs: +| | | | | | | binary: +| | | | | | | | text: ->, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | rhs: +| | | | | | | | identifier: String, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | lhs: +| | | | | | | | identifier: obj, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | __proto__: +| | | | | | | | __name__: C_binary, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | | __proto__: +| | | | | | __name__: C_binary, +| | | | __proto__: +| | | | | __name__: C_exprStatement, +| | | 3: +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | binary: +| | | | | | text: =, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | rhs: +| | | | | | paramTypeL: +| | | | | | | 0: +| | | | | | | | identifier: value, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | declarators: +| | | | | | | identifier: strlen, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | rparen: +| | | | | | | text: ), +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | lparen: +| | | | | | | text: (, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_call, +| | | | | lhs: +| | | | | | binary: +| | | | | | | text: ., +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | identifier: size, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | lhs: +| | | | | | | binary: +| | | | | | | | text: ->, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | rhs: +| | | | | | | | identifier: String, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | lhs: +| | | | | | | | identifier: obj, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | __proto__: +| | | | | | | | __name__: C_binary, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | | __proto__: +| | | | | | __name__: C_binary, +| | | | __proto__: +| | | | | __name__: C_exprStatement, +| | | 4: +| | | | returnTok: +| | | | | text: return, +| | | | | comment: +| | | | | | text: , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: +, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | identifier: obj, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: C_id, +| | | | __proto__: +| | | | | __name__: C_return, +| | __proto__: +| | | __name__: C_compound, +| declarationL: null, +| declarators: +| | paramTypeL: +| | | 0: +| | | | declarators: +| | | | | star: +| | | | | | text: *, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | typeQualList: null, +| | | | | declarators: +| | | | | | identifier: value, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_id, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: C_deref, +| | | | specifiers: +| | | | | 0: +| | | | | | text: char, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: C_parameter, +| | declarators: +| | | identifier: makeString, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: C_id, +| | rparen: +| | | text: ), +| | | comment: +| | | | text: +, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | lparen: +| | | text: (, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | __file__: parsimonyLibrary/fake-static-classes.mc, +| | __line__: 63, +| | __proto__: +| | | __name__: C_call, +| specifiers: +| | 0: +| | | text: int, +| | | comment: +| | | | text: , +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| __file__: parsimonyLibrary/fake-static-classes.mc, +| __line__: 63, +| __proto__: +| | __name__: C_functionDef +} +{ +| compoundS: +| | leftCurly: +| | | text: {, +| | | comment: +| | | | text: + , +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | rightCurly: +| | | text: }, +| | | comment: +| | | | text: +, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | __file__: parsimonyLibrary/fake-static-classes.mc, +| | __line__: 63, +| | expression: +| | | 0: +| | | | declarators: +| | | | | 0: +| | | | | | binary: +| | | | | | | text: =, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | paramTypeL: +| | | | | | | | 0: +| | | | | | | | | sizeOfTok: +| | | | | | | | | | text: sizeof, +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: Token, +| | | | | | | | | typeName: +| | | | | | | | | | declarators: null, +| | | | | | | | | | specifiers: +| | | | | | | | | | | 0: +| | | | | | | | | | | | structTok: +| | | | | | | | | | | | | text: struct, +| | | | | | | | | | | | | comment: +| | | | | | | | | | | | | | text: , +| | | | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | | | __name__: Comment, +| | | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | | __name__: Token, +| | | | | | | | | | | | attribute2: null, +| | | | | | | | | | | | attribute1: null, +| | | | | | | | | | | | declarationL: null, +| | | | | | | | | | | | leftCurly: null, +| | | | | | | | | | | | rightCurly: null, +| | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | name: +| | | | | | | | | | | | | identifier: String, +| | | | | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | | | | __line__: 63, +| | | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | | __name__: C_id, +| | | | | | | | | | | | __proto__: +| | | | | | | | | | | | | __name__: C_structSpec, +| | | | | | | | | | semicolon: null, +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: C_declaration, +| | | | | | | | | rparen: +| | | | | | | | | | text: ), +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: Token, +| | | | | | | | | lparen: +| | | | | | | | | | text: (, +| | | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | | __line__: 63, +| | | | | | | | | | __proto__: +| | | | | | | | | | | __name__: Token, +| | | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | | __line__: 63, +| | | | | | | | | __proto__: +| | | | | | | | | | __name__: C_sizeOf, +| | | | | | | declarators: +| | | | | | | | identifier: malloc, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | rparen: +| | | | | | | | text: ), +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | lparen: +| | | | | | | | text: (, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_call, +| | | | | | lhs: +| | | | | | | identifier: obj, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | specifiers: +| | | | | 0: +| | | | | | identifier: oop, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_id, +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: C_declaration, +| | | 1: +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | binary: +| | | | | | text: =, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | rhs: +| | | | | | identifier: String, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_id, +| | | | | lhs: +| | | | | | binary: +| | | | | | | text: ->, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | identifier: type, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | lhs: +| | | | | | | identifier: obj, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | | __proto__: +| | | | | | __name__: C_binary, +| | | | __proto__: +| | | | | __name__: C_exprStatement, +| | | 2: +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | binary: +| | | | | | text: =, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | rhs: +| | | | | | paramTypeL: +| | | | | | | 0: +| | | | | | | | identifier: value, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | declarators: +| | | | | | | identifier: strdup, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | rparen: +| | | | | | | text: ), +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | lparen: +| | | | | | | text: (, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_call, +| | | | | lhs: +| | | | | | binary: +| | | | | | | text: ., +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | identifier: value, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | lhs: +| | | | | | | binary: +| | | | | | | | text: ->, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | rhs: +| | | | | | | | identifier: String, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | lhs: +| | | | | | | | identifier: obj, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | __proto__: +| | | | | | | | __name__: C_binary, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | | __proto__: +| | | | | | __name__: C_binary, +| | | | __proto__: +| | | | | __name__: C_exprStatement, +| | | 3: +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: + , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | binary: +| | | | | | text: =, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | rhs: +| | | | | | paramTypeL: +| | | | | | | 0: +| | | | | | | | identifier: value, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | declarators: +| | | | | | | identifier: strlen, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | rparen: +| | | | | | | text: ), +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | lparen: +| | | | | | | text: (, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_call, +| | | | | lhs: +| | | | | | binary: +| | | | | | | text: ., +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Token, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | rhs: +| | | | | | | identifier: size, +| | | | | | | comment: +| | | | | | | | text: , +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Comment, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: C_id, +| | | | | | lhs: +| | | | | | | binary: +| | | | | | | | text: ->, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: Token, +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | rhs: +| | | | | | | | identifier: String, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | lhs: +| | | | | | | | identifier: obj, +| | | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | | __line__: 63, +| | | | | | | | __proto__: +| | | | | | | | | __name__: C_id, +| | | | | | | __proto__: +| | | | | | | | __name__: C_binary, +| | | | | | __proto__: +| | | | | | | __name__: C_binary, +| | | | | __proto__: +| | | | | | __name__: C_binary, +| | | | __proto__: +| | | | | __name__: C_exprStatement, +| | | 4: +| | | | returnTok: +| | | | | text: return, +| | | | | comment: +| | | | | | text: , +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | semicolon: +| | | | | text: ;, +| | | | | comment: +| | | | | | text: +, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Comment, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | expression: +| | | | | identifier: obj, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: C_id, +| | | | __proto__: +| | | | | __name__: C_return, +| | __proto__: +| | | __name__: C_compound, +| declarationL: null, +| declarators: +| | paramTypeL: +| | | 0: +| | | | declarators: +| | | | | star: +| | | | | | text: *, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | | typeQualList: null, +| | | | | declarators: +| | | | | | identifier: value, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: C_id, +| | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | __line__: 63, +| | | | | __proto__: +| | | | | | __name__: C_deref, +| | | | specifiers: +| | | | | 0: +| | | | | | text: char, +| | | | | | comment: +| | | | | | | text: , +| | | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | | __line__: 63, +| | | | | | | __proto__: +| | | | | | | | __name__: Comment, +| | | | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | | | __line__: 63, +| | | | | | __proto__: +| | | | | | | __name__: Token, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: C_parameter, +| | declarators: +| | | identifier: makeString, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: C_id, +| | rparen: +| | | text: ), +| | | comment: +| | | | text: +, +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | lparen: +| | | text: (, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| | __file__: parsimonyLibrary/fake-static-classes.mc, +| | __line__: 63, +| | __proto__: +| | | __name__: C_call, +| specifiers: +| | 0: +| | | text: int, +| | | comment: +| | | | text: , +| | | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | | __line__: 63, +| | | | __proto__: +| | | | | __name__: Comment, +| | | __file__: parsimonyLibrary/fake-static-classes.mc, +| | | __line__: 63, +| | | __proto__: +| | | | __name__: Token, +| __file__: parsimonyLibrary/fake-static-classes.mc, +| __line__: 63, +| __proto__: +| | __name__: C_functionDef +} \ No newline at end of file diff --git a/tests-parsimony/objectExample.c b/tests-parsimony/objectExample.c new file mode 100644 index 0000000..6fb3111 --- /dev/null +++ b/tests-parsimony/objectExample.c @@ -0,0 +1,28 @@ +@import("parsimonyLibrary/fake-static-classes.mc") + +typedef long long int_t; +typedef long double flt_t; + +@object() + +struct Integer { + int_t i; +}; +@addObject() + +// struct Float { +// flt_t _value; +// }; +// @addObject() + +struct String { + char *value; +}; +@addObject() + +// struct Symbol { +// char *name; +// }; +// @addObject() + +@endObject() diff --git a/tests-parsimony/parsimony-lang/003.c b/tests-parsimony/parsimony-lang/003.c index 7c3a04a..aa234d5 100644 --- a/tests-parsimony/parsimony-lang/003.c +++ b/tests-parsimony/parsimony-lang/003.c @@ -1,4 +1,4 @@ -@{import("boot.mc");} +@{import("parsimonyLibrary/boot.mc");} @{ nTimes = `constant 10; diff --git a/tests-parsimony/parsimony-lang/005.c b/tests-parsimony/parsimony-lang/005.c index 72c3ae4..8abf523 100644 --- a/tests-parsimony/parsimony-lang/005.c +++ b/tests-parsimony/parsimony-lang/005.c @@ -1,4 +1,4 @@ -@{import("boot.mc");} +@{import("parsimonyLibrary/boot.mc");} @{ l = {}; diff --git a/tests-parsimony/parsimony-lang/006.c b/tests-parsimony/parsimony-lang/006.c index e308e40..70fa4c4 100644 --- a/tests-parsimony/parsimony-lang/006.c +++ b/tests-parsimony/parsimony-lang/006.c @@ -1,4 +1,4 @@ -@{import("boot.mc");} +@{import("parsimonyLibrary/boot.mc");} @{ l = {}; diff --git a/tests-parsimony/parsimony-lang/007.c b/tests-parsimony/parsimony-lang/007.c index 78024f1..c1172f1 100644 --- a/tests-parsimony/parsimony-lang/007.c +++ b/tests-parsimony/parsimony-lang/007.c @@ -1,4 +1,4 @@ -@{import("boot.mc");} +@{import("parsimonyLibrary/boot.mc");} @{ l = {}; diff --git a/tests-parsimony/parsimony-lang/map.c b/tests-parsimony/parsimony-lang/map.c index e294a52..58e2bfd 100644 --- a/tests-parsimony/parsimony-lang/map.c +++ b/tests-parsimony/parsimony-lang/map.c @@ -1,4 +1,4 @@ -@{import("boot.mc");} +@{import("parsimonyLibrary/boot.mc");} enum foo { A, B, C }; enum oof { A, B, C }; diff --git a/tests-parsimony/projExample.c b/tests-parsimony/projExample.c index 372eb18..97a650b 100644 --- a/tests-parsimony/projExample.c +++ b/tests-parsimony/projExample.c @@ -1,11 +1,10 @@ -@{import("boot.mc");} +@{import("parsimonyLibrary/boot.mc");} enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 }; @{ idToString(x) {{ __proto__: C_string, value: "\"" + string(x.name.identifier) + "\"" }} - notToken(x) { x.__proto__ != Token } nil; } -static char *stateNames[] = { @(map(idToString, program.enums.foo.enumList, notToken)) }; \ No newline at end of file +static char *stateNames[] = { @(map(idToString, program.last.enumList, notToken)) }; \ No newline at end of file diff --git a/tests-parsimony/testFile.c b/tests-parsimony/testFile.c index 9af8bf0..3d095ea 100644 --- a/tests-parsimony/testFile.c +++ b/tests-parsimony/testFile.c @@ -1,4 +1,4 @@ -@(import("fake-static-classes.mc")) +@(import("parsimonyLibrary/fake-static-classes.mc")) @{ //creation of the class diff --git a/tests-parsimony/testFile2.c b/tests-parsimony/testFile2.c index a0e5880..e2b2aac 100644 --- a/tests-parsimony/testFile2.c +++ b/tests-parsimony/testFile2.c @@ -1,4 +1,4 @@ -@(import("fake-static-classes.mc")) +@(import("parsimonyLibrary/fake-static-classes.mc")) @{ //creation of the object class