Blame view

circus/src/jcircus/JCircusControllerText.java 2.19 KB
8d0dc533f   Madiel de Souza Conserva Filho   first
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  /*
   * JCircusControllerText.java
   */
  
  package jcircus;
  
  import java.util.List;
  import jcircus.util.Error;
  import jcircus.complementaryenvs.ProcCreateMainEnv;
  import jcircus.exceptions.FailParsingException;
  import jcircus.exceptions.FailTranslationException;
  import jcircus.exceptions.FailTypeCheckingException;
  import jcircus.exceptions.JCircusException;
  import jcircus.exceptions.TranslationCancelledException;
  import jcircus.translator.Translator2Java;
  import net.sourceforge.czt.z.ast.Spec;
  import net.sourceforge.czt.base.ast.Term;
  import net.sourceforge.czt.typecheck.z.ErrorAnn;
  public class JCircusControllerText extends JCircusController {
      /**
       * Constructor.
       */
      public JCircusControllerText() { }
      protected void translate2Java (String projectDir, String projectName, Spec spec, String compl, boolean useBarriers, boolean parallelism, boolean bench)
              throws FailTranslationException, TranslationCancelledException, JCircusException {
  
          //_translator = new Translator2Java(projectDir, projectName, spec, compl, useBarriers, parallelism, bench, new JCircusController (), false);
  
          // Translate the specification, and store the resulting code in ProcInfo
          _translator.translate(false);
  
          // Create the source code files
          _translator.createSources(); 
      }
      
      protected void reportMessage (String message) {
          System.out.println(message);
      }
      
      /**
       *
       */
      protected void reportParsingErrors(List<String> errors) throws FailParsingException {
  
          String message = parsingErrorMessage(errors);
          reportMessage(message);
          throw new FailParsingException(errors);
      }
      
      /**
       *
       */
      protected void reportTypeCheckingErrors(List<ErrorAnn> errors) throws FailTypeCheckingException {
          String message = typeCheckingErrorMessage(errors);
          reportMessage(message);
          throw new FailTypeCheckingException(errors);
      }
      
      /**
       *
       */
      protected void reportTranslationErrors(List<Error> errors) throws FailTranslationException {
          String message = translationErrorMessage(errors);
          reportMessage(message);
          throw new FailTranslationException(errors);
      }
  }