# HG changeset patch # User Mike Pavone # Date 1276662968 0 # Node ID d0ce696786cce0bc475f65ed480b5c9acd4201d0 # Parent 38d9cd036d4976b833c4ecda5af87ed139c7f02e Clean up debug print statements a bit. Fix bug that prevented workers that took no inputs from working. Remove workaround in Array for said bug. diff -r 38d9cd036d49 -r d0ce696786cc cbackend.rhope --- a/cbackend.rhope Mon Jun 07 15:36:04 2010 -0400 +++ b/cbackend.rhope Wed Jun 16 04:36:08 2010 +0000 @@ -355,7 +355,6 @@ Type Inits@C Type Registry[reg,method reg,field reg:out] { out <- Fold[[[["_Type Inits C"]Set Input[0, reg]]Set Input[1, method reg]]Set Input[2, field reg], "", [reg]Definitions >>] - { Print["Type inits got output"] } } Register Type@C Type Registry[reg,def:out] @@ -367,7 +366,6 @@ { out <- reg }{ - Print[["Registered def for "]Append[name]] out <- [reg]Definitions <<[[[reg]Definitions >>]Set[name, def]] } }{ @@ -388,13 +386,9 @@ Simple Type?@C Type Registry[reg,name:yep,nope,notfound] { - Print[["Symple Type?: "]Append[name]] ,notfound <- [[reg]Definitions >>]Index[name] { - Print["found type"] yep,nope <- If[[[[~]Fields >>]Length] = [1]] - }{ - Pretty Print[reg, ""] } } @@ -452,15 +446,11 @@ Register Constant@C Function[func,name,constant:out] { - Print["Register Constant"] - Print[name] out <- [func]Constants <<[ [[func]Constants >>]Set[name, constant] ] - { Print["Got register constant output"] } } Allocate Var@C Function[func,name,type:out] { - Print[["Allocate Var: "]Append[name]] out <- [func]Variables <<[ [[func]Variables >>]Set[name,type] ] } @@ -565,14 +555,12 @@ Release@C Function[func,psource:out] { source <- [psource]Make Op[func] - Print[["Release: "]Append[source]] out <- [func]Add Statement[[["release_ref((object *)"]Append[source]]Append[")"]] } Set Null@C Function[func,pdest:out] { dest <- [pdest]Make Op[func] - Print[["Set Null: "]Append[dest]] out <- [func]Add Statement[[dest]Append[" = NULL"]] } @@ -636,7 +624,6 @@ Set Field Null@C Function[func,var,field:out] { - Print["Set Field Null"] out <- [func]Add Statement[ [[func]Field Result[var,field]]Append[" = NULL"] ] } @@ -907,7 +894,6 @@ Naked Proto@C Function[func:out] { - Print[["Naked Proto: "]Append[ [func]Name >>] ] [[func]Output Types >>]Index[0] { outtype <- [Rhope Type to C[~]]Append[" "] @@ -919,7 +905,6 @@ ]Append["("] ]Append[ [Fold[["_Proto Input"]Set Input[3, [func]Input Types >>], (), [func]Inputs >>]]Join[", "] ] ]Append[")"] - { Print[~] } } Type Check@C Function[func,text,type,input num:out] @@ -1089,31 +1074,25 @@ _Set Consts C Program[text,value,name,type reg:out] { - Print[["_Set Consts: "]Append[valtype]] - Pretty Print[value, "_Set Consts: "] //TODO: Support more constant types valtype <- Type Of[value] [("Int32","Whole Number")]Find[valtype] { out <- [text]Append[[[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = make_Int32("]]Append[value]]Append[");\n"]] - { Print["_Set Consts got output integer"] } }{ If[[valtype] = ["Type Instance"]] { //TODO: Support parametric types typeid <- [type reg]Type ID[[value]Name >>] out <- [text]Append[[[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = make_Blueprint("]]Append[typeid]]Append[");\n"]] - { Print["_Set Consts got output blueprint"] } }{ If[[valtype] = ["Yes No"]] { If[value] { out <- [text]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = (object *)val_yes;\n"]] - { Print["_Set Consts got output yes"] } }{ out <- [text]Append[[["\t_const_"]Append[Escape Rhope Name[name]]]Append[" = (object *)val_no;\n"]] - { Print["_Set Consts got output no"] } } }{ If[[valtype] = ["Machine Integer"]] @@ -1279,7 +1258,6 @@ Text@C Program[program:out] { - Print["Text@C Program"] type defs <- [[program]Type Registry >>]Definitions >> constants <- Fold["Combine Consts", Dictionary[], [program]Functions >>] all methods <- Fold["Field to Types", Fold["Method to Types", Dictionary[], type defs], type defs] diff -r 38d9cd036d49 -r d0ce696786cc extendlib.rhope --- a/extendlib.rhope Mon Jun 07 15:36:04 2010 -0400 +++ b/extendlib.rhope Wed Jun 16 04:36:08 2010 +0000 @@ -675,7 +675,7 @@ { out <- _Fold[list, start, newlist, "Append"] }{ - out <- newlist + out <- Val[newlist] } } diff -r 38d9cd036d49 -r d0ce696786cc kernel.rhope --- a/kernel.rhope Mon Jun 07 15:36:04 2010 -0400 +++ b/kernel.rhope Wed Jun 16 04:36:08 2010 +0000 @@ -59,10 +59,10 @@ If[[n] < [0i32]] { val <- [0i32]-[n] - buf <- [Array[1]]Append[45i8] + buf <- [Array[]]Append[45i8] }{ val <- Val[n] - buf <- Array[1] + buf <- Array[] } fbuf <- [_Print Int32[val, buf]]Append[10i8] out <- write[1i32, fbuf, Int64[[fbuf]Length >>]] @@ -152,7 +152,7 @@ out <- [_internal_blueprint_eq[left,right]]!=[0] } -Array[n:out(Array)] +Array[:out(Array)] { out <- [[_internal_array_allocboxed[0] ]Length <<[0] diff -r 38d9cd036d49 -r d0ce696786cc number.rhope --- a/number.rhope Mon Jun 07 15:36:04 2010 -0400 +++ b/number.rhope Wed Jun 16 04:36:08 2010 +0000 @@ -97,7 +97,6 @@ Register Number Method[program, method, type, outtype:out] { name <- [[method]Append["@"]]Append[type] - Print[["Regsiter Number Method: "]Append[name]] out <- [[program]Register Worker[name, "rhope", 2, 1] ]Bind Worker[name, [[[[[NWorker["rhope"] @@ -112,7 +111,6 @@ Register Conversion Method[program, intype, outtype,prefix:out] { name <- [prefix]Append[[[outtype]Append["@"]]Append[intype]] - Print[["Registering conversion: "]Append[name]] out <- [[program]Register Worker[name, "rhope", 1, 1] ]Bind Worker[name, [[[[[NWorker["rhope"] @@ -149,7 +147,6 @@ _Register Number Methods[program,type:out] { - Print[["_Regsiter Number Methods: "]Append[type]] methods <- ("+", "-", "*", "/", "LShift", "RShift") compmethods <- ("<", ">", "=", "<=", ">=", "!=") register <- ["Register Number Method"]Set Input[2, type] diff -r 38d9cd036d49 -r d0ce696786cc nworker.rhope --- a/nworker.rhope Mon Jun 07 15:36:04 2010 -0400 +++ b/nworker.rhope Wed Jun 16 04:36:08 2010 +0000 @@ -57,18 +57,12 @@ _For Backend Subset[current,subset,type:out] { - Print["Calling For Backend on subset"] - { [subset]For Backend { - Print["Got output from for backend"] out <- [[>]First { - Print["At least one var"] [[set]Variables >>]Next[~] { - Print["at least two vars"] vars <- _Fold[[set]Variables >>, ~, firstvar, ["_For Backend Var"]Set Input[3, [set]Condition Type >>]] }{ - Print["just one var"] vars <- Val[firstvar] } out <- Fold[["_For Backend Subset"]Set Input[2, [set]Condition Type >>], vars, [set]Subsets >>] - { Print["done For Backend, with vars"] } }{ - Print["no vars"] [[set]Subsets >>]First Non-empty Set { - Print[["At least one non-empty subset: "]Append[~]] firstsub <- [[[set]Subsets >>]Index[~]]For Backend [[set]Subsets >>]Next[~] { - Print["at least two subsets"] out <- _Fold[[set]Subsets >>, ~, firstsub, ["_For Backend Subset"]Set Input[2, [set]Condition Type >>]] - { Print["done with subsets, but no vars"] } }{ out <- Val[firstsub] - { Pretty Print[~, "1s:\t"] } } }{ - Print["done with none"] none <- Yes } } @@ -464,9 +447,7 @@ Infer Types@NWorker[worker,prog:out] { - Print[["Start inference: "]Append[[worker]Name >>]] out <- [worker]Nodes <<[Fold[[["Infer Types Node"]Set Input[3, prog]]Set Input[4, worker], [worker]Nodes >>, [worker]Nodes >>]] - { Print[["End inference: "]Append[[worker]Name >>]] } } Add Worker Call@NWorker[worker,tocall:out,node index] @@ -519,17 +500,10 @@ Add Wire@NWorker[worker,from,output,to,input:out] { - Print[[[[[[[[["Add Wire@NWorker["]Append[from]]Append[","]]Append[output]]Append[","]]Append[to]]Append[","]]Append[input]]Append["]"]] - { fromw <- [[[worker]Nodes >>]Index[from]]Wire From[to,input,output] - { Print["fromw"] } tow <- [[[worker]Nodes >>]Index[to]]Wire To[from,output,input] - { Print["tow"] } nodes <- [[[worker]Nodes >>]Set[from, fromw]]Set[to, tow] - { Print["nodes"] } out <- [worker]Nodes <<[nodes] - { Print["Add Wire@NWorker done"] } - } } Uses@NWorker[worker,uses:out] @@ -714,18 +688,12 @@ Collect Conditions@NWorker[worker,node:out] { - Print["Collect Conditions"] - { out <- Fold[["Collect Condition"]Set Input[0, worker], AndSet[], [node]Wires To>>] - { Print["done Collect Conditions"] } - } } Save Result[func,num,node index:out] { - Print["Save Result"] out var <- [[["__result_"]Append[node index]]Append["_"]]Append[num] - Print[out var] /*out <- [[func]Allocate Var[out var, "Any Type"] ]Move[Result[num], out var] */ @@ -742,21 +710,11 @@ { with call <- [func]Set Field Call[[node]Data >>, [inputs]Index[0], [inputs]Index[1]] }{ - Print[["Call: "]Append[[[node]Data >>]Name >>]] - { [program]Method?[[[node]Data >>]Name >>] { - Print["Method!"] with call <- [func]Method Call[[[node]Data >>]Name >>, inputs] - { Print["Method Call done"] } }{ - Print["Function!"] - { - Pretty Print[inputs, ""] - { with call <- [func]Call[[[node]Data >>]Name >>, inputs]} - } - - } + with call <- [func]Call[[[node]Data >>]Name >>, inputs] } } } @@ -765,7 +723,6 @@ Compile Node@NWorker[worker,program,func,nodes,current:out,out worker] { - Print[["Compile Node: "]Append[[node]Type >>]] node index <- [nodes]Index[current] node <- [[worker]Nodes >>]Index[node index] conditions <- [worker]Collect Conditions[node] @@ -774,11 +731,9 @@ inputs <- [worker]Collect Inputs[node] [conditions]For Backend { - Print["Conditional execution, do if"] stream <- [func]Instruction Stream nfunc <- [func]Do If[~, nstream] }{ - Print["No conditions, full steam ahead"] stream <- Val[func] nfunc <- Val[nstream] } @@ -786,15 +741,12 @@ }{ If[[[node]Type >>] = ["output"]] { - Print["Compiling output node"] inputs <- [worker]Collect Inputs[node] [conditions]For Backend { - Print["has conditions"] stream <- [func]Instruction Stream nfunc <- [func]Do If[~, nstream] }{ - Print["no conditions"] stream <- Val[func] nfunc <- Val[nstream] } @@ -910,9 +862,6 @@ { func <- [ifunc]Set Input Type[Make Basic Type[input type], index] name <- [inputs]Index[index] - Print[["FInputs: "]Append[index]] - Pretty Print[input type, ""] - { If[[[input type]Variant >>] = ["Naked"]] { @@ -946,7 +895,6 @@ out <- Val[copied] } } - } } FParams[input:out] @@ -963,7 +911,6 @@ } _Return Param[outputs, inputs, input types, index:out,none] { - Print[["_Return Param: "]Append[output]] output <- [outputs]Index[index] [inputs]Find[output] { @@ -983,7 +930,6 @@ Return Param[outputs, inputs, input types:out,none] { - Print["Return Param"] ,none <- [outputs]First { out,none <- _Return Param[outputs, inputs, input types, ~] } @@ -1012,7 +958,6 @@ Compile Foreign Stub[worker,program,name:out] { - Print[["Compiling FFI stub for "]Append[name]] ifunc <- [[program]Create Function[name, [worker]Inputs >>, [worker]Outputs >>, "rhope"] ]Output Types <<[Map[[worker]Output Types >>, "Make Basic Type"]] @@ -1046,8 +991,6 @@ }{ If[[[worker]Library >>] = [""]] { - Print[["Compiling: "]Append[name]] - { ifunc <- Fold["Set Output Type", Fold["Set Input Type", [program]Create Function[name,[worker]Inputs >>, [worker]Outputs >>, [worker]Convention >>], [worker]Input Types >>], [worker]Output Types >>] res vars <- [worker]Result Vars @@ -1061,7 +1004,6 @@ final func <- Val[func] } out <- [program]Store Function[Fold["Release", Fold[["Release Var"]Set Input[0, worker], final func, res vars], [worker]Inputs >>]] - } }{ out <- Compile Foreign Stub[worker,[program]Link[[worker]Convention >>, [worker]Library >> ],name] } @@ -1140,13 +1082,10 @@ Make Init[func,field:out] { name <- [field]Index[0] - Print[["Field: "]Append[name]] - { Print[[" Variant: "]Append[variant]] } variant <- [[field]Index[1]]Variant >> If[[variant] = ["Boxed"]] { out <- [func]Set Field Null["obj", name] - { Print["done"] } }{ out <- func } @@ -1188,7 +1127,6 @@ Make Special@NBlueprint[bp,backend,func name,bp name,pop worker:out] { - Print[[["Make Special: "]Append[func name]]Append[bp name]] func <- [[backend]Create Function[func name,("obj"),(),"cdecl"] ]Set Input Type[Type Instance[bp name], 0] out <- [backend]Store Function[Fold[pop worker, func, [bp]Fields >>]] @@ -1197,7 +1135,6 @@ Getters Setters[backend,field,type name:out] { //TODO: Throw an exception or something if we read a field that is empty - Print[["Getters Setters: "]Append[name]] name <- [field]Index[0] type <- [field]Index[1] mytype <- Type Instance[type name] @@ -1210,7 +1147,6 @@ getter <- [[start getter]Do AddRef[getref, "out"]]Release["obj"] }{ getter <- [[start getter]Box[getref, "out", type]]Release["obj"] - { Print["Got getter"] } } begin setter <- [[[[[backend]Create Function[ [[[name]Append[" <<"]]Append["@"]]Append[type name], ("obj","newval"), ("out"), "rhope"] @@ -1230,7 +1166,6 @@ { setter <- [[~]Move["newval", setref] ]Move["obj", "out"] - { Print["got setter"] } } } }{ @@ -1238,7 +1173,6 @@ { setter <- [[~]Unbox["newval", setref] ]Move["obj", "out"] - { Print ["got setter"] } } } @@ -1248,7 +1182,6 @@ Compile Blueprint@NBlueprint[bp,backend,name:out] { - Print[["Compiling blueprint: "]Append[name]] //Rhope identifiers can't start with spaces, so we can use identifiers that start with spaces for special functions init name <- [" init "]Append[name] copy name <- [" copy "]Append[name] @@ -1257,7 +1190,6 @@ ]Init <<[init name] ]Copy <<[copy name] ]Cleanup <<[cleanup name] - { Print["Created type on backend"] } out <- [backend]Register Type[type] } @@ -1303,7 +1235,6 @@ Bind Blueprint@NProgram[prog,name,blueprint:out] { - Print[["Bind blueprint: "]Append[name]] out <- [prog]Blueprints << [ [[prog]Blueprints >>]Set[name, blueprint] ] } @@ -1319,16 +1250,13 @@ _Compile Program[backend, worker, name:out] { - Print["_Compile Program"] out <- [worker]Compile Worker[backend, name] } Compile Program@NProgram[prog, backend:out] { backend with bps <- Generate Boolean Methods[Generate Number Methods[Fold["_Compile Program BP Special", Fold["_Compile Program BP", backend, [prog]Blueprints >>], [prog]Blueprints >>]]] - { Print["All blueprints added"] } workers with infer <- SMap[[prog]Workers >>, ["Infer Types"]Set Input[1, prog]] - { Print["Type inference complete"] } out <- Fold["_Compile Program", backend with bps, workers with infer] } @@ -1339,7 +1267,6 @@ Register Worker@NProgram[prog, name, convention, inputs, outputs: out] { - Print[["Register Worker "]Append[name]] after reg <- [prog]Worker Refs <<[ [ [prog]Worker Refs >> ]Set[name, Worker Ref[name, convention, inputs, outputs, No] @@ -1394,7 +1321,6 @@ Find Worker@NProgram[prog, name:out,notfound] { - Print[ ["Find Worker@NProgram: "]Append[name] ] out,notfound <- [[prog]Worker Refs >>]Index[name] } diff -r 38d9cd036d49 -r d0ce696786cc parser_old.rhope --- a/parser_old.rhope Mon Jun 07 15:36:04 2010 -0400 +++ b/parser_old.rhope Wed Jun 16 04:36:08 2010 +0000 @@ -215,8 +215,6 @@ Add Blocks to Worker[blocks,worker,program,parse worker,refs:out blocks,out worker,out refs] { - Print["Add Blocks to Worker"] - { [blocks]First { out blocks, out worker, out refs <- _Add Blocks to Worker[blocks, worker, program, parse worker, ~, refs] @@ -225,7 +223,6 @@ out worker <- worker out refs <- refs } - } } Add to Worker@Worker Node[node,worker,program,parse worker,refs:out node,out worker,out refs] @@ -250,87 +247,37 @@ Add Multi Wire[worker,ref,junk,end index,input num:out] { - Print[ - [[[[[[["Wire: " - ]Append[ [ref]Index >> ] - ]Append[","] - ]Append[ [ref]Output Number >>] - ]Append[" to "] - ]Append[end index] - ]Append[","] - ]Append[input num] - ] out <- [worker]Add Wire[[ref]Index >>, [ref]Output Number >>, end index, input num] - { Print["Wire added"] } } Add Param Wire[worker,param,input num,end index,blocks,parse worker,assignments:out] { - Print[[[["param type: " - ]Append[Type Of[param]] - ]Append[", dest index:"] - ]Append[end index]] - { param worker, start index, output num <- [param]Add Wires[worker, blocks, parse worker, assignments] {} { - Print[ - [[[[[[["Wire: " - ]Append[start index ] - ]Append[","] - ]Append[output num] - ]Append[" to "] - ]Append[end index] - ]Append[","] - ]Append[input num] - ] { out <- [param worker]Add Wire[start index, output num, end index, input num] - { Print["wire done, Add Param Wire"] } - } }{}{ out <- Fold[[["Add Multi Wire"]Set Input[3, end index]]Set Input[4, input num], param worker, ~] } - } } _Add Block Wire[worker,node,junk,blocks,parse worker,assignments:out] { - Print[["_Add Block Wire "]Append[Type Of[node]]] - { - out <- [node]Add Wires[worker, blocks, parse worker, assignments] - { Print[["_Add Block Wire done "]Append[Type Of[node]]] } - } + out <- [node]Add Wires[worker, blocks, parse worker, assignments] } Add Block Wire[worker,block nodes,output num,parent index,existing blocks,parse worker,assignments:out] { - Print["Add Block Wire"] - { blocks <- [existing blocks]Append[New@Output Reference[parent index, output num]] out <- Fold[[[["_Add Block Wire"]Set Input[3, blocks]]Set Input[4, parse worker]]Set Input[5, assignments], worker, block nodes] - { Print["done: Add Block Wire"] } - } } Assignments Add Wires[worker,assignment,output num,parse worker,start index:out worker] { - Print[["Assignments Add Wires: "]Append[assignment]] - { [[parse worker]Outputs >>]Find[assignment] { ,output index <- [worker]Add Typed Output[assignment, ~, [[parse worker]Output Types >>]Index[~]] { - Print[ - [[[[[[["Wire: " - ]Append[ start index ] - ]Append[","] - ]Append[ output num] - ]Append[" to "] - ]Append[output index] - ]Append[","] - ]Append[ 0 ] - ] out worker <- [~]Add Wire[start index, output num, output index, 0] - { Print["wire done, Assignments Add Wires 1"] } } }{ //Ugly hack alert! @@ -340,15 +287,12 @@ ,global index <- [worker]Add Global Set[[parts]Index[0], [parts]Index[1]] { out worker <- [~]Add Wire[start index, output num, global index, 0] - { Print["wire done, Assignments Add Wires 2"] } } }{ - Print["Pipe assignment, do nothing"] - { out worker <- worker } + out worker <- worker } } } -} Has Block@Worker Node[junk:out,unused] { @@ -382,22 +326,15 @@ Add Wires@Worker Node[node,worker,blocks,parse worker,assignments:worker,index,num,unused] { - Print["Add Wires@Worker Node"] - { worker,index,num <- Add Wires Worker or Field[node, worker, blocks, parse worker, assignments] - } } Add Wires Worker or Field[node,worker,blocks,parse worker,assignments:worker,index,num,unused] { - Print["Add Wires Worker or Field"] - { Fold[[["Assignments Add Wires"]Set Input[3, parse worker]]Set Input[4, [node]Index >>], worker, [node]Assignments >>] { - Print["Assignments Add Wires done"] Fold[[[[["Add Block Wire"]Set Input[3, [node]Index >>]]Set Input[4, blocks]]Set Input[5, parse worker]]Set Input[6, assignments], ~, [node]Blocks >>] { - Print["Add Block Wire fold done"] params worker <- Fold[[[[["Add Param Wire"]Set Input[3, [node]Index >>]]Set Input[4, blocks]]Set Input[5, parse worker]]Set Input[6, assignments], ~, [node]Params >>] }} If[Has Block Params[[node]Params >>]] { @@ -412,7 +349,6 @@ } index <- [node]Index >> num <- 0 - } } Blueprint Field Node @@ -457,10 +393,7 @@ Add Wires@Field Node[node,worker,blocks,parse worker,assignments:worker,index,num] { - Print["Add Wires@Field Node"] - { worker,index,num <- Add Wires Worker or Field[node, worker, blocks, parse worker, assignments] - } } Blueprint Named Pipe Node @@ -498,7 +431,6 @@ { after add <- [worker]Add Typed Input[[node]Name >>, ~, [[parse worker]Input Types>>]Index[~]] {} { - Print[["Added input, node:"]Append[~]] assign refs <- Fold[[["Assignment Save Reference"]Set Input[3, parse worker]]Set Input[4, ~], refs, [node]Assignments >>] index node <- [node]Index <<[~] } @@ -514,8 +446,6 @@ Add Wires@Named Pipe Node[node,worker,blocks,parse worker,assignments:worker,index,num,reflist] { - Print["Add Wires@Named Pipe Node"] - { reflist <- [assignments]Index[[node]Name >>] { //TODO: Fix support for a named pipe with a block @@ -549,7 +479,6 @@ } } } - } index <- Val[my index] worker <- Fold[[[[["Add Block Wire"]Set Input[3, my index]]Set Input[4, blocks]]Set Input[5, parse worker]]Set Input[6, assignments], wires worker, [node]Blocks >>] @@ -618,29 +547,20 @@ Add Wires@Literal Node[node,worker,blocks,parse worker,assignments:worker,index,num,unused] { - Print["Add Wires@Literal Node"] - { worker,index,num <- Add Wires Literal or Global[node, worker, blocks, parse worker, assignments] - } } Add Wires Literal or Global[node,worker,blocks,parse worker,junk:worker,index,num,unused] { - Print["Add Wires Literal or Global"] - { assignments worker <- Fold[[["Assignments Add Wires"]Set Input[3, parse worker]]Set Input[4, [node]Index >>], worker, [node]Assignments >>] - { Print["Done fold Assignments Add Wires"] } [blocks]Peek { - Print["Add wire"] worker <- [assignments worker]Add Wire[[~]Index >>, [~]Output Number>>, [node]Index >>, [0]-[1]] - { Print["Add wire done"] } }{ worker <- Val[assignments worker] } index <- [node]Index >> num <- 0 - } } Blueprint Block Node @@ -1210,8 +1130,15 @@ delims <- [[()]Append[[params]List Begin >>]]Append[[params]List Delim >>] after,param name <-[text]Get DString[delims] {} { - nextlist <- [paramlist]Append[Trim[~, "\r\n\t "]] - next types <- [typelist]Append[paramtype] + tname <- Trim[~, "\r\n\t "] + If[[tname] = [""]] + { + nextlist <- Val[paramlist] + next types <- Val[typelist] + }{ + nextlist <- [paramlist]Append[tname] + next types <- [typelist]Append[paramtype] + } }{ If[[~] = [[params]List Begin >>]] { @@ -1271,7 +1198,6 @@ ,whitespace name <- [string]Get Comment DString[[params]Arg Begin >>, params] { worker name <- Trim[whitespace name, "\n\r\t "] - Print[["Parsing worker: "]Append[worker name]] in out <- [params]In Out Delim >> arg end <- [params]Arg End >> delims <- [[()]Append[in out]]Append[arg end] @@ -1286,8 +1212,6 @@ rest <- [after]Get Comment DString[arg end, params] {} { outputs,output types <- Parse Param List[~, (), (), params] - { Print["got outputs"] } - { Print["got output types"] } } }{ rest <- Val[after] @@ -1295,8 +1219,6 @@ output types <- () } inputs,input types <- Parse Param List[arglist, (), (), params] - { Print["got inputs"] } - { Print["got input types"] } worker <- New@Parse Worker[worker name, inputs, outputs, input types, output types, 0] } }{}{}{ @@ -1308,7 +1230,6 @@ { ,after arglist <- Worker Declaration[string, params] { - Print["Got parse worker"] worker name <- [~]Name >> body text, modifiers <- [after arglist]Get Comment DString[[params]Block Begin >>, params] modified <- Process Modifiers[~, params, modifiers] @@ -1335,9 +1256,7 @@ Parse Foreign[string,params,tree,lines:out] { - Print["Foreign block"] ,after foreign <- [string]Slice[[[params]Foreign >>]Length] - Print[[after foreign]Slice[20]] [after foreign]Get Comment DString[[params]Blueprint Type Delim >>, params] { [~]Get Comment DString[[params]Block Begin >>, params] @@ -1347,13 +1266,10 @@ { lib <- Trim[~, "\r\n\t "] } } { language <- Trim[~, "\r\n\t "] } - Print[[[["Language: "]Append[language]]Append[" Library: "]]Append[lib]] - { Parse Foreign Worker[tree, body, New Foreign Lib[language, lib], params] { out <- Null[rest, params, ~, 0] } - } } Null[string,params,tree,lines:out] @@ -1392,7 +1308,6 @@ Register Workers Compile[prog, worker, name:out] { - Print[["Registering "]Append[name]] If[[ Type Of[[worker]Trees >>] ] = ["Foreign Lib"]] { convention <- Val[[[worker]Trees >>]Language >>] } { convention <- "rhope" } @@ -1401,8 +1316,6 @@ Add Workers Compile[prog, worker, name:out] { - Print[["Add Workers Compile: "]Append[name]] - { If[[Type Of[[worker]Trees >>]] = ["Foreign Lib"]] { //TODO: Handle foreign func @@ -1418,21 +1331,15 @@ final nworker <- Fold[[["Add Wires Helper"]Set Input[3, worker]]Set Input[4, refs], nworker, trees] } out <- [prog]Bind Worker[name, final nworker] - } } Add Wires Helper[worker,node,unused,parse worker,assignments:out] { - Print["Add Wires Helper"] - { out <- [node]Add Wires[worker, (), parse worker, assignments] - { Print["Add Wires Helper Done"] } - } } Add Contents[parse worker,name,program:out,key] { - Print[["Add Contents: "]Append[name]] worker <- [[program]Find Worker[name]]Uses[[parse worker]Uses Stores >>] trees, contents worker, refs <- Add List to Worker[[parse worker]Trees >>, worker, program, parse worker, Dictionary[]] Fold[[["Add Wires Helper"]Set Input[3, parse worker]]Set Input[4, refs], contents worker, trees] @@ -1463,22 +1370,17 @@ after blueprint <- Fold["Add Blueprint", program, [parse tree]Blueprints >>] [[parse tree]Workers >>]First { - Print["Adding workers"] prog <- Add Workers[[parse tree]Workers >>, ~, after blueprint] - { Print["Add Workers done"] } }{ Print["No workers!"] } Key Value Map[[parse tree]Workers >>, ["Add Contents"]Set Input[2, prog]] - { Print["Done Add Contents"] } out <- Val[prog] } Tree to Program[parse tree:out] { - Print["Tree to Program"] out <- _Tree to Program[parse tree, [Program[]]Add Builtins] - { Print["done"] } } Tree to Program Native[parse tree:out] @@ -1572,29 +1474,18 @@ { _REPL[params, _Tree to Program[import tree, prog], ~] } } }{ - Print["Expression"] trees <- Worker Body[[line]Append["}"], params, ()] - { Print["Parse done"] } tree <- [New@Worker Node["Val", [()]Append[[trees]Index[0]]]]Assignments <<[("__out")] - { Print["Constructed new tree"] } this stores <- [[tree]Gather Stores[params, Dictionary[]]]Keys - { Print["Got stores"] } next stores <- Fold["_Init Used Store", stores, this stores] { - Print["Initialized stores"] pworker <- [[New@Parse Worker["__Eval", (), ("__out"), 0]]Trees <<[[()]Append[tree]]]Uses Stores <<[this stores] - { Print["Constructed parse worker"] } } [[prog]Find Worker["__Eval"]]Clear { - Print["Cleared worker"] Add Contents[pworker, "__Eval", prog] { - Print["Added Contents"] - Pretty Print[[[[prog]Find Worker["__Eval"]]Do[()]]Index[0], ""] - { - Print["Finished executeion"] - _REPL[params, prog, next stores] } } } + _REPL[params, prog, next stores] } } } } } @@ -1654,7 +1545,6 @@ Main[args] { - Print["start"] fname <- [args]Index[1] { file <- >, Int64[[[string]Buffer >>]Length >>]] - { out <- write[1i32, [Array[1]]Append[10u8], 1i64] } + { out <- write[1i32, [Array[]]Append[10u8], 1i64] } } Flatten@String[string:out]