Changeset 3895 for applications/trunk/LFC/ToASR/ToASR.rf
- Timestamp:
- Sep 2, 2008, 4:54:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/trunk/LFC/ToASR/ToASR.rf
r3893 r3895 29 29 $func CallEarley t.var = e.call; 30 30 CallEarley (EVAR (s.n e.name)) = 31 (RESULT (CALL (Earley Earley) ( TYPE (e.name)) (EVAR (s.n e.name))))31 (RESULT (CALL (Earley Earley) (PAREN TYPE (PAREN e.name)) (EVAR (s.n e.name)))) 32 32 (FORMAT (EVAR (s.n))); 33 33 … … 43 43 <L s.n e.args> : (EVAR (s.n e.type_name)), 44 44 (RESULT (EVAR (s.n))) 45 (LEFT <FreshEVAR> ( (TYPE (e.type_name) (EVAR (0 s.n))) <Map &VarType (e.var_decls) (e.pattern)> DOT 0) <FreshEVAR>)45 (LEFT <FreshEVAR> (PAREN (PAREN TYPE (PAREN e.type_name) (EVAR (0 s.n))) <Map &VarType (e.var_decls) (e.pattern)> DOT 0) <FreshEVAR>) 46 46 (RESULT (CALL (Earley RemoveParens) (EVAR (0 s.n)))) 47 47 (LEFT <Map &GetVar (e.pattern)>); … … 50 50 VarType (e.var_decls) t.pat, { 51 51 t.pat : (VAR t.name) = 52 e.var_decls : e (e t.pat e t.type) e = t.type;52 e.var_decls : e (e t.pat e (TYPE (e.type_name))) e = (PAREN TYPE (PAREN e.type_name)); 53 53 t.pat; 54 54 }; … … 93 93 )); 94 94 95 $func AddPAREN e = e; 96 AddPAREN { 97 (e1) e2 = (PAREN <AddPAREN e1>) <AddPAREN e2>; 98 s1 e2 = s1 <AddPAREN e2>; 99 /*empty*/ = /*empty*/; 100 }; 101 95 102 $box ModuleName; 96 103 … … 101 108 Main = 102 109 <ParseFile "samples.lfc"> :: e.ast, 103 < ParseGrammarFile "samples.g"> :: e.grammar,110 <AddPAREN <ParseGrammarFile "samples.g">> :: e.grammar, 104 111 <Store &ModuleName "samples">, 105 <WriteLn (MODULE (<Get &ModuleName>) <Comp e.ast> <GenerMain ('isBit') e.grammar>)>; 112 (IMPORT FUNC ("refal" "plus" StdIO WriteLn) ((EVAR)) ()) 113 (IMPORT FUNC (Earley Init) ((EVAR)) ()) 114 (IMPORT FUNC (Earley RemoveParens) ((EVAR)) ((EVAR))) 115 (IMPORT FUNC (Earley Earley) ((TVAR) (EVAR)) ((EVAR))) :: e.imports, 116 <Channel> :: s.ch, 117 <OpenFile s.ch "samples.asr" W>, 118 <WriteLnCh s.ch (MODULE (<Get &ModuleName>) e.imports <Comp e.ast> <GenerMain ('isBit') e.grammar>)>, 119 <CloseChannel s.ch>;
Note: See TracChangeset
for help on using the changeset viewer.