Mercurial > repos > rhope
diff backendutils.rhope @ 90:c25d75c2440b
Implemented Next@Dictionary and Print@Dictionary
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 31 Jul 2010 15:08:15 -0400 |
parents | 0083b2f7b3c7 |
children | e73a93fb5de1 |
line wrap: on
line diff
--- a/backendutils.rhope Sat Jul 31 00:19:15 2010 -0400 +++ b/backendutils.rhope Sat Jul 31 15:08:15 2010 -0400 @@ -1,7 +1,7 @@ Escape Rhope Name NU[name:escaped] { - escaped <- [[[[[[[[[[[[[[[[[[[[name]Replace["_","UN_"] + escaped <- [[[[[[[[[[[[[[[[[[[[[[[name]Replace["_","UN_"] ]Replace["@","AT_"] ]Replace[" ","SP_"] ]Replace[":","CN_"] @@ -13,14 +13,17 @@ ]Replace["<","LT_"] ]Replace[">","GT_"] ]Replace["(","LP_"] - ]Replace[")","RP_"] - ]Replace["!","NT_"] - ]Replace["=","EQ_"] - ]Replace["'","PR_"] - ]Replace["\"","DP_"] - ]Replace["\t","TB_"] - ]Replace[",", "CM_"] + ]Replace[")","RP_"] + ]Replace["!","NT_"] + ]Replace["=","EQ_"] + ]Replace["'","PR_"] + ]Replace["\"","DP_"] + ]Replace["\t","TB_"] + ]Replace[",", "CM_"] ]Replace[".", "PD_"] + ]Replace["\n", "NL_"] + ]Replace["{", "LC_"] + ]Replace["}", "RC_"] } Escape Rhope Name[name:escaped] @@ -42,66 +45,66 @@ { //TODO: Make me work with other backends out <- [["add_ref((object *)"]Append[ [[addref]Value >>]Make Op[func] ]]Append[")"] -} - -Strip Addref@AddRef[op:out] -{ - out <- [[op]Value >>]Strip Addref +} + +Strip Addref@AddRef[op:out] +{ + out <- [[op]Value >>]Strip Addref } Make Op@String[string,func:out] { out <- [func]Resolve[string] -} - -Strip Addref@String[op:out] -{ - out <- op +} + +Strip Addref@String[op:out] +{ + out <- op } Make Op@Whole Number[num,func:out] { out <- num -} - -Strip Addref@Whole Number[op:out] -{ - out <- op +} + +Strip Addref@Whole Number[op:out] +{ + out <- op } Make Op@Real Number[num,func:out] { out <- num -} - -Strip Addref@Real Number[op:out] -{ - out <- op -} - -Blueprint Output -{ - Name -} - -Output[name:out] -{ - out <- [Build["Output"]]Name <<[name] -} - -Make Op@Output[op,func:out] -{ - out <- [func]Resolve Output[[op]Name >>] -} - -Strip Addref@Output[op:out] -{ - out <- op +} + +Strip Addref@Real Number[op:out] +{ + out <- op +} + +Blueprint Output +{ + Name +} + +Output[name:out] +{ + out <- [Build["Output"]]Name <<[name] +} + +Make Op@Output[op,func:out] +{ + out <- [func]Resolve Output[[op]Name >>] +} + +Strip Addref@Output[op:out] +{ + out <- op } Blueprint Constant { - Value + Value Need Addref } @@ -113,11 +116,11 @@ Make Op@Constant[const,func:out] { out <- [func]Lookup Constant[[const]Value >>, [const]Need Addref >>] -} - -Strip Addref@Constant[op:out] -{ - out <- [op]Need Addref <<[No] +} + +Strip Addref@Constant[op:out] +{ + out <- [op]Need Addref <<[No] } Blueprint Result @@ -133,13 +136,13 @@ Make Op@Result[result,func:out] { out <- [func]Result Reference[[result]Output Num>>] -} - -Strip Addref@Result[op:out] -{ - out <- op -} - +} + +Strip Addref@Result[op:out] +{ + out <- op +} + Blueprint Check Result { Output Num @@ -153,21 +156,21 @@ Make Op@Check Result[result,func:out] { out <- [func]Checked Result Reference[[result]Output Num>>] -} - -Strip Addref@Check Result[op:out] -{ - out <- op -} - -Make Condition[op:out] -{ - If[[Type Of[op]]=["OrValue"]] - { - out <- OrCond[Make Condition[[op]Left >>], Make Condition[[op]Right >>]] - }{ - out <- op - } +} + +Strip Addref@Check Result[op:out] +{ + out <- op +} + +Make Condition[op:out] +{ + If[[Type Of[op]]=["OrValue"]] + { + out <- OrCond[Make Condition[[op]Left >>], Make Condition[[op]Right >>]] + }{ + out <- op + } } Blueprint OrValue @@ -184,11 +187,11 @@ Make Op@OrValue[orval,func:out] { out <- [func]If Null Else[[orval]Left >>, [orval]Right >>] -} - -Strip Addref@OrValue[op:out] -{ - out <- [[op]Left <<[ [[op]Left >>]Strip Addref ]]Right <<[ [[op]Right >>]Strip Addref ] +} + +Strip Addref@OrValue[op:out] +{ + out <- [[op]Left <<[ [[op]Left >>]Strip Addref ]]Right <<[ [[op]Right >>]Strip Addref ] } Blueprint NotCond @@ -204,11 +207,11 @@ Make Op@NotCond[cond,func:out] { out <- ["!"]Append[[[cond]Condition >>]Make Op[func]] -} - -Strip Addref@NotCond[op:out] -{ - out <- op +} + +Strip Addref@NotCond[op:out] +{ + out <- op } Blueprint OrCond @@ -225,11 +228,11 @@ Make Op@OrCond[cond,func:out] { out <- ["("]Append[[[ [[cond]Condition1 >>]Make Op[func] ]Append[" || "]]Append[[ [[cond]Condition2 >>]Make Op[func] ]Append[")"]]] -} - -Strip Addref@OrCond[op:out] -{ - out <- op +} + +Strip Addref@OrCond[op:out] +{ + out <- op } Blueprint AndCond @@ -246,11 +249,11 @@ Make Op@AndCond[cond,func:out] { out <- ["("]Append[[[ [[cond]Condition1 >>]Make Op[func] ]Append[" && "]]Append[[ [[cond]Condition2 >>]Make Op[func] ]Append[")"]]] -} - -Strip Addref@AndCond[op:out] -{ - out <- op +} + +Strip Addref@AndCond[op:out] +{ + out <- op } Blueprint Field Ref @@ -267,18 +270,18 @@ Make Op@Field Ref[ref,func:out] { out <- [func]Field Result[[ref]Variable >>,[ref]Field >>] -} - -Strip Addref@Field Ref[op:out] -{ - out <- op +} + +Strip Addref@Field Ref[op:out] +{ + out <- op } Blueprint Type Instance { Name Params - Variant + Variant Mutable? } @@ -313,20 +316,21 @@ ,out <- If[[[type]Name >>] = [[compare]Name >>]] { out <- [[type]Variant >>] = [[compare]Variant >>] } } -} - -Blueprint Worker Literal -{ - Name - Args -} - Worker Literal[name:out] -{ - out <- [[Build["Worker Literal"]]Name <<[name]]Args <<[()] -} - -Set Input@Worker Literal[worker,argnum,val:out] -{ - out <- [worker]Args <<[ [[worker]Args >>]Set[argnum, val] ] -} - +} + +Blueprint Worker Literal +{ + Name + Args +} + +Worker Literal[name:out] +{ + out <- [[Build["Worker Literal"]]Name <<[name]]Args <<[()] +} + +Set Input@Worker Literal[worker,argnum,val:out] +{ + out <- [worker]Args <<[ [[worker]Args >>]Set[argnum, val] ] +} +