# HG changeset patch # User Mike Pavone # Date 1287719715 14400 # Node ID cd25171e1bb276338d0f365a5abf4babac744ef9 # Parent 72c648bca43b8dbbb080e333de36845abce9bd07 Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting. diff -r 72c648bca43b -r cd25171e1bb2 cbackend_c.rhope --- a/cbackend_c.rhope Mon Oct 18 00:50:18 2010 -0400 +++ b/cbackend_c.rhope Thu Oct 21 23:55:15 2010 -0400 @@ -633,6 +633,7 @@ } + Set Field Null@C Function[func,var,field:out] { out <- [func]Add Statement[ [[func]Field Result[var,field]]Append[" = NULL"] ] @@ -1233,7 +1234,7 @@ [(String(),String Slice(),String Cat())]Find[=[valtype,?]] { - out <- [["make_String(\""]Append[ [[[value]Replace["\\", "\\\\"]]Replace["\n", "\\n"]]Replace["\"", "\\\""] ]]Append["\")"] + out <- [["make_String(\""]Append[ [[[[value]Replace["\\", "\\\\"]]Replace["\n", "\\n"]]Replace["\"", "\\\""]]Replace["\r", "\\r"] ]]Append["\")"] }{ If[[valtype]=[Worker Literal()]] { @@ -1281,6 +1282,7 @@ valtype <- Blueprint Of[value] [(String(),String Cat(),String Slice(),Worker Literal(),List(),List Leaf())]Find[=[valtype,?]] { + Print[[name]Append[" is not of an early constant type"]] out <- text }{ Const Construct C[value,type reg] @@ -1307,7 +1309,7 @@ { If[[~]>[3]] { - out <- [Fold[_Set List Els[?, ?, ?, type reg], "\trhope(FUNC_List, inout, 0, 1);\n", value] + out <- [Fold[_Set List Els[?, ?, ?, type reg], [text]Append["\trhope(FUNC_List, inout, 0, 1);\n"], value] ]Append[[["\t_const_"]Append[Escape Rhope Name[name,[type reg]Escape Pattern >>]]]Append[" = inout[0];\n"]] }{ Const Construct C[value,type reg] diff -r 72c648bca43b -r cd25171e1bb2 nworker_c.rhope --- a/nworker_c.rhope Mon Oct 18 00:50:18 2010 -0400 +++ b/nworker_c.rhope Thu Oct 21 23:55:15 2010 -0400 @@ -11,12 +11,12 @@ AndSet[:out] { - out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[Dictionary[]]]Condition Type <<["And"] + out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[()]]Condition Type <<["And"] } OrSet[:out] { - out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[Dictionary[]]]Condition Type <<["Or"] + out <- [[[Build[Condition Set()]]Variables <<[Dictionary[]]]Subsets <<[()]]Condition Type <<["Or"] } To String@Condition Set[set:out] @@ -35,13 +35,13 @@ If[[[set]Condition Type >>]=[[cond]Condition Type >>]] { out <- [[set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ] - ]Subsets <<[ Combine[[set]Subsets >>, [cond]Subsets >>] ] + ]Subsets <<[ Concatenate[[set]Subsets >>, [cond]Subsets >>] ] }{ [cond]Empty? { [cond]Simple? { out <- [set]Variables <<[ Combine[[set]Variables >>, [cond]Variables >>] ] } - { out <- [set]Subsets <<[ [[set]Subsets>>]Set[[cond]To String, cond] ] } + { out <- [set]Subsets <<[ [[set]Subsets>>]Append[cond] ] } }{ out <- set } @@ -1218,10 +1218,9 @@ { 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 >>] - + groups <- [worker]Dependency Groups - groups <- [worker]Dependency Groups - [groups]First + fgroup <- [groups]First { with conds <- [worker]Save Group Conditions[groups, ~] final func <- [with conds]Compile Group[program,func,groups, ~]