diff --git a/scope4j/build.gradle b/scope4j/build.gradle
index dc2f6007ba8f036ff07eafe6c2a6d3a9f922075e..869de2a7ebd4428fbea730c69623e6706b398cdb 100644
--- a/scope4j/build.gradle
+++ b/scope4j/build.gradle
@@ -140,6 +140,9 @@ jastadd {
 
 run {
     mainClassName = 'org.extendj.ScopeAnalysis'
+    if (project.hasProperty("appArgs")) {
+        args Eval.me(appArgs)
+    }
 }
 
 task preprocess(type: JavaExec) {
diff --git a/scope4m/build.gradle b/scope4m/build.gradle
index 6cdb37b272bdf932236c899576cedf2dfeba4d7d..25c25674bb45f34f0d9c9bdc4cfe3c731cda173a 100644
--- a/scope4m/build.gradle
+++ b/scope4m/build.gradle
@@ -105,6 +105,9 @@ jastadd {
 
 run {
     mainClassName = 'org.jmodelica.SimpleMain'
+    if (project.hasProperty("appArgs")) {
+        args Eval.me(appArgs)
+    }
 }
 
 task preprocess(type: JavaExec) {
diff --git a/scope4m/src/main/java/org/jmodelica/ScopeAnalysis.java b/scope4m/src/main/java/org/jmodelica/ScopeAnalysis.java
index a7dd42db699179a4d5e981856d9b49ff96fcaa69..916b6d9c9e30939fea4bada78e1c2fe50880861f 100644
--- a/scope4m/src/main/java/org/jmodelica/ScopeAnalysis.java
+++ b/scope4m/src/main/java/org/jmodelica/ScopeAnalysis.java
@@ -35,15 +35,16 @@ public class ScopeAnalysis {
     boolean debug = arguments.isEmpty() || arguments.remove("--debug");
     boolean tree = arguments.remove("--tree");
     boolean warnings = arguments.remove("--warnings");
+    boolean ast = arguments.remove("--ast");
 
     if (arguments.size() > 1) {
-      System.out.println("usage: ScopeAnalysis [--debug] [--tree] [--warnings] <directory with modelica files>");
+      System.out.println("usage: ScopeAnalysis [--debug] [--tree] [--warnings] [--ast] <directory with modelica files>");
       System.exit(-1);
     }
-    String path = arguments.isEmpty() ? "../testprograms/modelica/simple" : arguments.get(arguments.size() - 1);
+    String path = arguments.isEmpty() ? "../testprograms/modelica/simple" : arguments.get(0);
 
     if (debug) {
-      new ScopeAnalysis().analyze(path, tree, warnings);
+      new ScopeAnalysis().analyze(path, tree, warnings, ast);
     } else {
       new ScopeAnalysis().analyzeTimed(path);
     }
@@ -97,7 +98,7 @@ public class ScopeAnalysis {
   }
 
 
-  public Set<AbstractFinding> analyze(String path, boolean tree, boolean warnings) {
+  public Set<AbstractFinding> analyze(String path, boolean tree, boolean warnings, boolean ast) {
     try {
       List<String> files = Files.walk(Paths.get(path))
           .filter(Files::isRegularFile)
@@ -112,8 +113,9 @@ public class ScopeAnalysis {
 
       }
 
-      // TODO just temp debug output:
-      sourceRoot.printAST();
+      if (ast) {
+        sourceRoot.printAST();
+      }
 
       if (warnings) {
         // TODO find out if there are compiler warnings in JModelica