/** * * OOAS Compiler (Deprecated) * * Copyright 2015, Institute for Software Technology, Graz University of * Technology. Portions are copyright 2015 by the AIT Austrian Institute * of Technology. All rights reserved. * * SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED. * * Please notice that this version of the OOAS compiler is considered de- * precated. Only the Java version is maintained. * * Contributors: * Willibald Krenn (TU Graz/AIT) * Stefan Tiran (TU Graz/AIT) */ using System; using System.Collections.Generic; using System.Text; using TUG.Mogentes; using TUG.Mogentes.Codegen.PrologSymbolic; using TUG.Mogentes.Codegen.Prolog; namespace TUG.Mogentes.Codegen.PrologSymbolic { public sealed class OoaPrologSymbolicVisitor : OoaPrologVisitor { public override void visit(MainModule mainModule) { m_emitter.AppendLine("% Argos Generated"); m_emitter.AppendLine(String.Format("%{0}", Mogentes.Program.GetProgramVersion().ToString().Replace(Environment.NewLine, Environment.NewLine + "%"))); m_emitter.AppendLine("% Code-Gen Version: 0.3 symbolic"); m_emitter.Append("% Generated: "); m_emitter.AppendLine(System.DateTime.Now.ToString()); m_emitter.AppendLine("%------------------------------------------------------------------------"); m_emitter.AppendLine(""); String nameSpace = TUG.Mogentes.Program.Options.nameSpace; m_emitter.AppendLine(":- module(" + nameSpace + ", [var/2, input/1, searchDepth/1, qspace/2])."); m_emitter.AppendLine(":- use_module(library(file_systems))."); m_emitter.AppendLine(":- use_module(library(process))."); m_emitter.AppendLine(":- use_module(library(clpfd))."); m_emitter.AppendLine(":- use_module(library(clpb))."); m_emitter.AppendLine(":- use_module(library(lists))."); m_emitter.AppendLine(":- use_module(library(avl))."); m_emitter.AppendLine(":- use_module(library(ordsets))."); m_emitter.AppendLine(":- use_module(library(system))."); m_emitter.AppendLine(":- use_module(library(gauge))."); m_emitter.AppendLine(":- use_module(library(terms))."); m_emitter.AppendLine(":- use_module(library(sets))."); m_emitter.AppendLine(":- use_module(library(random))."); m_emitter.AppendLine(":- public(as/0)."); m_emitter.AppendLine(":- dynamic(as/0)."); m_emitter.AppendLine(":- dynamic(qstate_init/1)."); m_emitter.AppendLine(":- dynamic(qstate_constraints/1)."); m_emitter.AppendLine(":- public(qstate_init/1)."); m_emitter.AppendLine(":- public(qstate_constraints/1)."); m_emitter.AppendLine(":- dynamic(type/2)."); /*definition of search depth*/ m_emitter.AppendLine(""); m_emitter.AppendLine("% maximal search depth (change at will)"); m_emitter.AppendLine("searchDepth(" + TUG.Mogentes.Program.Options.searchDepth + ")."); m_emitter.AppendLine(""); /*definition of types*/ ExportTypes(mainModule); /* variable definition */ ExportVariables(mainModule); /* state definition */ ExportState(mainModule); /* initial state */ ExportInitialState(mainModule); /* input actions (controllables) */ ExportControllableActions(mainModule); /* output actions (observables) */ ExportObservableActions(mainModule); /* named actions */ ExportMethodsAndActions(mainModule); /* all types */ m_emitter.AppendLine("%definition of types"); m_emitter.AppendLine(OoaPrologType.typeDefinitions.ToString()); m_emitter.AppendLine(createTypeVisitor().GetInternalTypeDefinitions()); } public OoaPrologSymbolicVisitor(ParserState aState) : base(aState, new OoaPrologSymbolicExpression.Factory(), new OoaPrologIdentifier.Factory(), new OoaPrologSymbolicStatement.Factory(), new OoaPrologSymbolicType.Factory()) { } } }