| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2021-08-11 02:17:14 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2021-08-11 02:17:14 +0200 | 
| commit | cbc02bb477154f7a03dfccde424b3b7738faa195 (patch) | |
| tree | 34e8cc2121c2491833856bd5a15c145543d2f281 /src/core | |
| parent | f95ea4dd016bbf1a6e2a510fd519148ccb01f143 (diff) | |
...
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/generic/LambdaEvaluationCompiler.java | 89 | 
1 files changed, 89 insertions, 0 deletions
| diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/generic/LambdaEvaluationCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/generic/LambdaEvaluationCompiler.java new file mode 100644 index 0000000..c914d0c --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/generic/LambdaEvaluationCompiler.java @@ -0,0 +1,89 @@ +package tonkadur.wyrd.v1.compiler.fate.v1.computation.generic; + +import java.util.List; +import java.util.ArrayList; + +import tonkadur.fate.v1.lang.computation.generic.LambdaEvaluation; + +import tonkadur.wyrd.v1.lang.Register; + +import tonkadur.wyrd.v1.lang.meta.Computation; + +import tonkadur.wyrd.v1.lang.computation.Address; + +import tonkadur.wyrd.v1.compiler.fate.v1.Compiler; +import tonkadur.wyrd.v1.compiler.fate.v1.TypeCompiler; +import tonkadur.wyrd.v1.compiler.fate.v1.ComputationCompiler; + +import tonkadur.wyrd.v1.compiler.fate.v1.computation.GenericComputationCompiler; + + +public class LambdaEvaluationCompiler extends GenericComputationCompiler +{ +   public static Class get_target_class () +   { +      return LambdaEvaluation.class; +   } + +   public LambdaEvaluationCompiler (final Compiler compiler) +   { +      super(compiler); +   } + +   public void compile +   ( +      final tonkadur.fate.v1.lang.computation.GenericComputation computation +   ) +   throws Throwable +   { +      final LambdaEvaluation source; +      final ComputationCompiler parent_cc; +      final ComputationCompiler target_line_cc; +      final List<Computation> parameters; +      final Register result; + +      source = (LambdaEvaluation) computation; + + +      parameters = new ArrayList<Computation>(); +      target_line_cc = new ComputationCompiler(compiler); + +      source.get_lambda_function().get_visited_by(target_line_cc); + +      assimilate(target_line_cc); + +      result = reserve(TypeCompiler.compile(compiler, source.get_type())); + +      result_as_address = result.get_address(); +      result_as_computation = result.get_value(); + +      for +      ( +         final tonkadur.fate.v1.lang.meta.Computation param: +            source.get_parameters() +      ) +      { +         final ComputationCompiler cc; + +         cc = new ComputationCompiler(compiler); + +         param.get_visited_by(cc); + +         assimilate(cc); + +         parameters.add(cc.get_computation()); +      } + +      init_instructions.add +      ( +         tonkadur.wyrd.v1.compiler.util.LambdaEvaluation.generate +         ( +            compiler.registers(), +            compiler.assembler(), +            target_line_cc.get_computation(), +            result_as_address, +            parameters +         ) +      ); +   } +} | 


