Mercurial > repos > rhope
comparison parser_old_c.rhope @ 136:fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 14 Nov 2010 23:07:55 -0500 |
parents | 04148770c229 |
children | a68e6828d896 |
comparison
equal
deleted
inserted
replaced
135:18a4403fe576 | 136:fc3815b7462f |
---|---|
29 String Escape | 29 String Escape |
30 List Begin | 30 List Begin |
31 List End | 31 List End |
32 List Delim | 32 List Delim |
33 In Out Delim | 33 In Out Delim |
34 Do Worker | |
35 Index Begin | 34 Index Begin |
36 Index End | 35 Index End |
37 Previous | 36 Previous |
38 Block Val | 37 Block Val |
39 Set Field | 38 Set Field |
47 Foreign | 46 Foreign |
48 } | 47 } |
49 | 48 |
50 Parser[:out] | 49 Parser[:out] |
51 { | 50 { |
52 out <- [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Build[Parser()] | 51 out <- [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[Build[Parser()] |
53 ]Arg Begin << ["["] | 52 ]Arg Begin << ["["] |
54 ]Arg End <<["]"] | 53 ]Arg End <<["]"] |
55 ]Line Comment <<["//"] | 54 ]Line Comment <<["//"] |
56 ]Comment Begin <<["/*"] | 55 ]Comment Begin <<["/*"] |
57 ]Comment End <<["*/"] | 56 ]Comment End <<["*/"] |
66 ]String Escape <<["\\"] | 65 ]String Escape <<["\\"] |
67 ]List Begin <<["("] | 66 ]List Begin <<["("] |
68 ]List End <<[")"] | 67 ]List End <<[")"] |
69 ]List Delim <<[","] | 68 ]List Delim <<[","] |
70 ]In Out Delim <<[":"] | 69 ]In Out Delim <<[":"] |
71 ]Do Worker <<["$"] | |
72 ]Index Begin <<["("] | 70 ]Index Begin <<["("] |
73 ]Index End <<[")"] | 71 ]Index End <<[")"] |
74 ]Previous <<["@"] | 72 ]Previous <<["@"] |
75 ]Set Field <<["<<"] | 73 ]Set Field <<["<<"] |
76 ]Get Field <<[">>"] | 74 ]Get Field <<[">>"] |
136 | 134 |
137 Parse Program[:out] | 135 Parse Program[:out] |
138 { | 136 { |
139 out <- [[[[Build[Parse Program()] | 137 out <- [[[[Build[Parse Program()] |
140 ]Workers <<[Dictionary[]] | 138 ]Workers <<[Dictionary[]] |
141 ]Imports <<[[Dictionary[]]Set["kernel.rhope", Yes]] | 139 ]Imports <<[Dictionary[]] |
142 ]Blueprints <<[Dictionary[]] | 140 ]Blueprints <<[Dictionary[]] |
143 ]Errors <<[()] | 141 ]Errors <<[()] |
144 } | 142 } |
145 | 143 |
146 Blueprint Blueprint Definition | 144 Blueprint Blueprint Definition |
1481 Add Blueprint Compile[prog,def:out] | 1479 Add Blueprint Compile[prog,def:out] |
1482 { | 1480 { |
1483 out <- [prog]Bind Blueprint[[def]Name >>, Fold[Add Blueprint Field[?], NBlueprint[], [def]Fields >>]] | 1481 out <- [prog]Bind Blueprint[[def]Name >>, Fold[Add Blueprint Field[?], NBlueprint[], [def]Fields >>]] |
1484 } | 1482 } |
1485 | 1483 |
1486 Tree to Program Native[parse tree:out] | 1484 Tree to Program Native[parse tree,number types:out] |
1487 { | 1485 { |
1488 registered <- Fold[Register Workers Compile[?], [Fold[Add Blueprint Compile[?], NProgram[], [parse tree]Blueprints >>]]Register Builtins, [parse tree]Workers >>] | 1486 registered <- Fold[Register Workers Compile[?], [Fold[Add Blueprint Compile[?], [NProgram[]]Numtypes <<[number types], [parse tree]Blueprints >>]]Register Builtins, [parse tree]Workers >>] |
1489 out <- Fold[Add Workers Compile[?], registered, [parse tree]Workers >>] | 1487 out <- Fold[Add Workers Compile[?], registered, [parse tree]Workers >>] |
1490 { Print["Transformed AST to dataflow graph "] } | 1488 { Print["Transformed AST to dataflow graph "] } |
1491 } | 1489 } |
1492 | 1490 |
1493 Needs Imports[needs import,not imported?,name:out] | 1491 Needs Imports[needs import,not imported?,name:out] |