From b80a95d54f3f1b229504bb09a462a03b6500028f Mon Sep 17 00:00:00 2001 From: Peizhao Ou Date: Wed, 7 Jan 2015 21:45:28 -0800 Subject: [PATCH] edits --- .../codeGenerator/CodeVariables.java | 5 +++++ .../codeGenerator/SemanticsChecker.java | 21 +++++++++++++------ .../specExtraction/Construct.java | 2 +- .../specExtraction/ParserUtils.java | 5 +++++ .../specExtraction/SpecExtractor.java | 10 ++++----- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java b/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java index 4c4fc87..12d0383 100644 --- a/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java +++ b/src/edu/uci/eecs/specCompiler/codeGenerator/CodeVariables.java @@ -20,6 +20,11 @@ import edu.uci.eecs.specCompiler.specExtraction.PotentialCPDefineConstruct; import edu.uci.eecs.specCompiler.specExtraction.SequentialDefineSubConstruct; import edu.uci.eecs.specCompiler.specExtraction.VariableDeclaration; +/** + *

Defines a list of commonly used constant strings.

+ * @author peizhaoo + * + */ public class CodeVariables { // C++ code or library public static final String HEADER_STDLIB = ""; diff --git a/src/edu/uci/eecs/specCompiler/codeGenerator/SemanticsChecker.java b/src/edu/uci/eecs/specCompiler/codeGenerator/SemanticsChecker.java index 23dad2f..ed20aa8 100644 --- a/src/edu/uci/eecs/specCompiler/codeGenerator/SemanticsChecker.java +++ b/src/edu/uci/eecs/specCompiler/codeGenerator/SemanticsChecker.java @@ -22,6 +22,15 @@ import edu.uci.eecs.specCompiler.specExtraction.PotentialCPDefineConstruct; import edu.uci.eecs.specCompiler.specExtraction.SourceFileInfo; import edu.uci.eecs.specCompiler.specExtraction.SpecExtractor; +/** + *

+ * A specificaiton semantics checker that checks the consistency of the + * specifications after they are extracted from the source code. + *

+ * + * @author peizhaoo + * + */ public class SemanticsChecker { public final HashMap srcFilesInfo; public final ArrayList constructs; @@ -212,18 +221,18 @@ public class SemanticsChecker { for (int j = 0; j < iConstruct.commitPointSet.size(); j++) { String label = iConstruct.commitPointSet.get(j); -// if (!CPLabel2InterfaceConstruct.containsKey(label)) { -// CPLabel2InterfaceConstruct.put(label, -// new ArrayList()); -// } -// CPLabel2InterfaceConstruct.get(label).add(iConstruct); + // if (!CPLabel2InterfaceConstruct.containsKey(label)) { + // CPLabel2InterfaceConstruct.put(label, + // new ArrayList()); + // } + // CPLabel2InterfaceConstruct.get(label).add(iConstruct); if (!CPLabel2InterfaceConstruct.containsKey(label)) { CPLabel2InterfaceConstruct.put(label, iConstruct); } else { throw new SemanticsCheckerException( "Commit point has multiple interfaces!"); } - + } } } diff --git a/src/edu/uci/eecs/specCompiler/specExtraction/Construct.java b/src/edu/uci/eecs/specCompiler/specExtraction/Construct.java index 0f42b05..7b6e788 100644 --- a/src/edu/uci/eecs/specCompiler/specExtraction/Construct.java +++ b/src/edu/uci/eecs/specCompiler/specExtraction/Construct.java @@ -4,7 +4,7 @@ import java.io.File; /** *

- * This is just an abstract class for all the constructs. + * An abstract class for all different specification constructs. *

* * @author peizhaoo diff --git a/src/edu/uci/eecs/specCompiler/specExtraction/ParserUtils.java b/src/edu/uci/eecs/specCompiler/specExtraction/ParserUtils.java index 201bb8c..b748a82 100644 --- a/src/edu/uci/eecs/specCompiler/specExtraction/ParserUtils.java +++ b/src/edu/uci/eecs/specCompiler/specExtraction/ParserUtils.java @@ -10,6 +10,11 @@ import edu.uci.eecs.specCompiler.codeGenerator.Environment; import edu.uci.eecs.specCompiler.grammerParser.utilParser.ParseException; import edu.uci.eecs.specCompiler.grammerParser.utilParser.UtilParser; +/** + *

Utility functions for parsing the specifications

+ * @author peizhaoo + * + */ public class ParserUtils { public static String trimSpace(String line) { int i, j; diff --git a/src/edu/uci/eecs/specCompiler/specExtraction/SpecExtractor.java b/src/edu/uci/eecs/specCompiler/specExtraction/SpecExtractor.java index 9d1fa91..439a60f 100644 --- a/src/edu/uci/eecs/specCompiler/specExtraction/SpecExtractor.java +++ b/src/edu/uci/eecs/specCompiler/specExtraction/SpecExtractor.java @@ -18,8 +18,9 @@ import edu.uci.eecs.specCompiler.grammerParser.TokenMgrError; *

* This class represents the specification extractor of the specification. The * main function of this class is to read C/C++11 source files and extract the - * corresponding specification out, and remember its location, including the - * file name and the line number, to help the code generation process. + * corresponding specifications, and record corresponding information such as + * location, e.g., the file name and the line number, to help the code + * generation process. *

* * @author peizhaoo @@ -31,7 +32,7 @@ public class SpecExtractor { public SpecExtractor() { srcFilesInfo = new HashMap(); } - + public ArrayList getConstructs() { ArrayList constructs = new ArrayList(); for (File f : srcFilesInfo.keySet()) { @@ -39,7 +40,7 @@ public class SpecExtractor { } return constructs; } - + /** *

* Given a list of files, it scans each file and add found SpecConstrcut to @@ -72,5 +73,4 @@ public class SpecExtractor { } } - } -- 2.34.1