Mercurial > repos > rhope
comparison parser_old.rhope @ 83:27bb051d631c
Initial implementation of Dictionary
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 27 Jul 2010 23:33:31 -0400 |
parents | 2e2e55fc12f9 |
children | e09c2d1d6d5b |
comparison
equal
deleted
inserted
replaced
82:2e2e55fc12f9 | 83:27bb051d631c |
---|---|
316 out <- [worker]Add Wire[[ref]Index >>, [ref]Output Number >>, end index, input num] | 316 out <- [worker]Add Wire[[ref]Index >>, [ref]Output Number >>, end index, input num] |
317 } | 317 } |
318 | 318 |
319 Add Param Wire[worker,param,input num,end index,blocks,parse worker,assignments:out] | 319 Add Param Wire[worker,param,input num,end index,blocks,parse worker,assignments:out] |
320 { | 320 { |
321 param worker, start index, output num <- [param]Add Wires[worker, blocks, parse worker, assignments] { Print["got param worker"] } | 321 param worker, start index, output num <- [param]Add Wires[worker, blocks, parse worker, assignments] {} |
322 { | 322 { |
323 out <- [param worker]Add Wire[start index, output num, end index, input num] | 323 out <- [param worker]Add Wire[start index, output num, end index, input num] |
324 }{}{ | 324 }{}{ |
325 out <- Fold[[["Add Multi Wire"]Set Input[3, end index]]Set Input[4, input num], param worker, ~] | 325 out <- Fold[[["Add Multi Wire"]Set Input[3, end index]]Set Input[4, input num], param worker, ~] |
326 } | 326 } |
632 } | 632 } |
633 } | 633 } |
634 | 634 |
635 Add Wires@Literal Node[node,worker,blocks,parse worker,assignments:worker,index,num,unused] | 635 Add Wires@Literal Node[node,worker,blocks,parse worker,assignments:worker,index,num,unused] |
636 { | 636 { |
637 Print[["Add Wires@Literal Node, Literal Type: "]Append[Type Of[[node]Value >>]]] | |
638 worker,index,num <- Add Wires Literal or Global[node, worker, blocks, parse worker, assignments] | 637 worker,index,num <- Add Wires Literal or Global[node, worker, blocks, parse worker, assignments] |
639 { Print["Got worker"] } | |
640 { Print["got index"] } | |
641 { Print["got num"] } | |
642 } | 638 } |
643 | 639 |
644 Check Worker Literals@Literal Node[node,program:out] | 640 Check Worker Literals@Literal Node[node,program:out] |
645 { | 641 { |
646 out <- [node]Blocks <<[ Map[[node]Blocks >>, ["Map"]Set Input[1, ["Check Worker Literals"]Set Input[1, program]]] ] | 642 out <- [node]Blocks <<[ Map[[node]Blocks >>, ["Map"]Set Input[1, ["Check Worker Literals"]Set Input[1, program]]] ] |
1412 } | 1408 } |
1413 } | 1409 } |
1414 | 1410 |
1415 Register Workers Compile[prog, worker, name:out] | 1411 Register Workers Compile[prog, worker, name:out] |
1416 { | 1412 { |
1417 Print[["Registering "]Append[name]] | 1413 //Print[["Registering "]Append[name]] |
1418 If[[ Type Of[[worker]Trees >>] ] = ["Foreign Lib"]] | 1414 If[[ Type Of[[worker]Trees >>] ] = ["Foreign Lib"]] |
1419 { convention <- Val[[[worker]Trees >>]Language >>] } | 1415 { convention <- Val[[[worker]Trees >>]Language >>] } |
1420 { convention <- "rhope" } | 1416 { convention <- "rhope" } |
1421 out <- [prog]Register Worker[name, convention, [[worker]Inputs >>]Length, [[worker]Outputs >>]Length] | 1417 out <- [prog]Register Worker[name, convention, [[worker]Inputs >>]Length, [[worker]Outputs >>]Length] |
1422 } | 1418 } |
1423 | 1419 |
1424 Add Workers Compile[prog, worker, name:out] | 1420 Add Workers Compile[prog, worker, name:out] |
1425 { | 1421 { |
1422 Print[["Transforming "]Append[name]] | |
1426 If[[Type Of[[worker]Trees >>]] = ["Foreign Lib"]] | 1423 If[[Type Of[[worker]Trees >>]] = ["Foreign Lib"]] |
1427 { | 1424 { |
1428 //TODO: Handle foreign func | 1425 //TODO: Handle foreign func |
1429 final nworker <- [[[[[NWorker[[[worker]Trees >>]Language >>] | 1426 final nworker <- [[[[[NWorker[[[worker]Trees >>]Language >>] |
1430 ]Inputs <<[ [worker]Inputs >> ] | 1427 ]Inputs <<[ [worker]Inputs >> ] |
1432 ]Outputs <<[ [worker]Outputs >> ] | 1429 ]Outputs <<[ [worker]Outputs >> ] |
1433 ]Output Types <<[ [worker]Output Types >> ] | 1430 ]Output Types <<[ [worker]Output Types >> ] |
1434 ]Library <<[ [[worker]Trees >>]Name >> ] | 1431 ]Library <<[ [[worker]Trees >>]Name >> ] |
1435 | 1432 |
1436 }{ | 1433 }{ |
1437 Print[["Transforming "]Append[name]] | |
1438 trees, nworker, refs <- Add List to Worker[[worker]Trees >>, [[NWorker["rhope"]]Uses[[worker]Uses Stores >>]]Outputs <<[ [worker]Outputs >> ], prog, worker, Dictionary[]] | 1434 trees, nworker, refs <- Add List to Worker[[worker]Trees >>, [[NWorker["rhope"]]Uses[[worker]Uses Stores >>]]Outputs <<[ [worker]Outputs >> ], prog, worker, Dictionary[]] |
1439 { | 1435 { |
1440 ,proceed <- If[[name] = ["Main"]] | |
1441 { Print["Added Trees to worker"] | |
1442 { proceed <- Pretty Print[trees, ""] }} | |
1443 Val[proceed] | |
1444 { | |
1445 final nworker <- Fold[[["Add Wires Helper"]Set Input[3, worker]]Set Input[4, refs], nworker, trees] | 1436 final nworker <- Fold[[["Add Wires Helper"]Set Input[3, worker]]Set Input[4, refs], nworker, trees] |
1446 { | |
1447 If[[name] = ["Main"]] | |
1448 { Print["Added wires to worker"] } | |
1449 } | |
1450 } | |
1451 } | 1437 } |
1452 | 1438 |
1453 } | 1439 } |
1454 out <- [prog]Bind Worker[name, final nworker] | 1440 out <- [prog]Bind Worker[name, final nworker] |
1455 } | 1441 } |