| summaryrefslogtreecommitdiff |
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2021-07-31 00:07:21 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2021-07-31 00:07:21 +0200 |
| commit | 74cd1955bd13623545fba1fc368cd797d8a08f02 (patch) | |
| tree | 8f2dee8ce9d7f2c819ecbaed8c159d016732422b | |
| parent | 9cd2f4e3b3a655f04ea19114a1ebb8b8d899e854 (diff) | |
Wyrd generic computation compiler
3 files changed, 90 insertions, 1 deletions
diff --git a/src/core/src/tonkadur/Main.java b/src/core/src/tonkadur/Main.java index ab086c1..a9c53d9 100644 --- a/src/core/src/tonkadur/Main.java +++ b/src/core/src/tonkadur/Main.java @@ -49,6 +49,11 @@ public class Main tp.pre_fate_parsing(fate_world, parser_data); } + if (RuntimeParameters.get_input_file() == null) + { + return; + } + try { parser_data.add_file_content diff --git a/src/core/src/tonkadur/RuntimeParameters.java b/src/core/src/tonkadur/RuntimeParameters.java index 3816bc7..1ecf107 100644 --- a/src/core/src/tonkadur/RuntimeParameters.java +++ b/src/core/src/tonkadur/RuntimeParameters.java @@ -115,7 +115,7 @@ public class RuntimeParameters return false; } - target_file = options[options.length - 1]; + target_file = null; options_it = Arrays.stream(options).iterator(); @@ -213,6 +213,10 @@ public class RuntimeParameters { print_license(); } + else if (!options_it.hasNext()) + { + target_file = option; + } } return true; diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/GenericComputationCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/GenericComputationCompiler.java new file mode 100644 index 0000000..6b08383 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/computation/GenericComputationCompiler.java @@ -0,0 +1,80 @@ +package tonkadur.wyrd.v1.compiler.fate.v1.computation; + +import java.util.Map; +import java.util.HashMap; + +import tonkadur.wyrd.v1.compiler.fate.v1.Compiler; +import tonkadur.wyrd.v1.compiler.fate.v1.ComputationCompiler; + +public abstract class GenericComputationCompiler extends ComputationCompiler +{ + protected static final Map<String, Class> ARCHETYPES; + + static + { + ARCHETYPES = new HashMap<String, Class>(); + } + + public static ComputationCompiler handle + ( + final Compiler compiler, + final tonkadur.fate.v1.lang.computation.GenericComputation computation + ) + throws Throwable + { + final Class registered_class; + final GenericComputationCompiler gcc; + + registered_class = ARCHETYPES.get(computation.get_name()); + + if (registered_class == null) + { + System.err.println + ( + "[F] No Wyrd compilation process registered for generic Fate " + + " computation \"" + + computation.get_name() + + "\"." + ); + + System.exit(-1); + } + + if (!GenericComputationCompiler.class.isAssignableFrom(registered_class)) + { + System.err.println + ( + "[F] The class registered to compile generic Fate " + + " computation \"" + + computation.get_name() + + "\" to Wyrd does not extend the GenericComputationCompiler class." + ); + + System.exit(-1); + } + + gcc = + (GenericComputationCompiler) + registered_class.getDeclaredConstructor(Compiler.class).newInstance + ( + compiler + ); + + gcc.compile(computation); + + return gcc; + } + + protected void compile + ( + final tonkadur.fate.v1.lang.computation.GenericComputation computation + ) + throws Throwable + { + } + + protected GenericComputationCompiler (final Compiler compiler) + { + super(compiler); + } +} |


