├── .gitattributes ├── .github └── workflows │ └── CI.yml ├── .gitignore ├── .gitmodules ├── .scalafmt.conf ├── bin ├── detect-build.sh ├── prelude.sh ├── sbt-launch.sh ├── sbt-release-test.sh └── util-reflect-gen.sh ├── build.sbt ├── cli └── jvm │ └── src │ ├── main │ ├── resources │ │ └── org │ │ │ └── sireum │ │ │ └── util │ │ │ └── reflect │ │ │ ├── CliGen.stg │ │ │ └── RewriterJsonGen.stg │ └── scala │ │ └── org │ │ ├── Sireum.scala │ │ └── sireum │ │ ├── Cli.scala │ │ ├── cli │ │ ├── .gitignore │ │ ├── Cli.scala │ │ ├── CliConfig.sc │ │ ├── Logika.scala │ │ ├── Sireum.scala │ │ └── cligen.sh │ │ ├── java │ │ └── translator │ │ │ └── JavaBytecodeTranslator.scala │ │ ├── logika │ │ └── Main.scala │ │ ├── option │ │ ├── JavaOption.scala │ │ ├── LogikaOption.scala │ │ ├── PilarOption.scala │ │ ├── SireumOption.scala │ │ ├── UtilOption.scala │ │ └── annotation │ │ │ └── OptionAnnotation.scala │ │ ├── pilar │ │ └── parser │ │ │ └── Parser.scala │ │ └── util │ │ └── reflect │ │ ├── .gitignore │ │ ├── CliGen.scala │ │ ├── ReflectGen.scala │ │ ├── Reflection.scala │ │ └── RewriterJsonGen.scala │ └── test │ └── scala │ └── org │ └── sireum │ ├── test │ └── CliRegressionTestSuite.scala │ └── util │ └── reflect │ ├── ReflectionTest.scala │ └── ReflectionTestDefProvider.scala ├── distros ├── build-ive.sh └── build.sh ├── java ├── jvm │ └── src │ │ ├── main │ │ └── scala │ │ │ └── org │ │ │ └── sireum │ │ │ └── java │ │ │ ├── JavaProfile.scala │ │ │ ├── meta │ │ │ ├── JavaMeta.scala │ │ │ └── JavaMetaJson.scala │ │ │ └── translator │ │ │ └── ClassBytecodeTranslator.scala │ │ └── test │ │ └── scala │ │ └── org │ │ └── sireum │ │ └── java │ │ └── test │ │ └── translator │ │ ├── ClassBytecodeTranslatorTest.scala │ │ └── ClassBytecodeTranslatorTestDefProvider.scala ├── readme.md └── todo.md ├── license.md ├── license.txt ├── pilar ├── js │ └── src │ │ └── test │ │ └── scala │ │ └── org │ │ └── sireum │ │ └── pilar │ │ └── test │ │ ├── ast │ │ ├── AstJsTest.scala │ │ └── PrettyPrinterJsTest.scala │ │ └── parser │ │ └── FastParserTestJs.scala ├── jvm │ └── src │ │ ├── main │ │ ├── java │ │ │ └── org │ │ │ │ └── sireum │ │ │ │ └── pilar │ │ │ │ └── parser │ │ │ │ ├── Antlr4Pilar.tokens │ │ │ │ ├── Antlr4PilarLexer.java │ │ │ │ ├── Antlr4PilarLexer.tokens │ │ │ │ └── Antlr4PilarParser.java │ │ ├── resources │ │ │ └── org │ │ │ │ └── sireum │ │ │ │ └── pilar │ │ │ │ └── parser │ │ │ │ └── Antlr4Pilar.g4 │ │ └── scala │ │ │ └── org │ │ │ └── sireum │ │ │ └── pilar │ │ │ └── ast │ │ │ └── Builder.scala │ │ └── test │ │ └── scala │ │ └── org │ │ └── sireum │ │ └── pilar │ │ └── test │ │ ├── PilarRegressionTestSuite.scala │ │ ├── ast │ │ ├── AstTest.scala │ │ └── PrettyPrinterTest.scala │ │ └── parser │ │ ├── Antlr4PilarParserTest.scala │ │ ├── Antlr4PilarParserTestDefProvider.scala │ │ └── FastParserTest.scala └── shared │ └── src │ └── main │ └── scala │ └── org │ └── sireum │ └── pilar │ ├── ast │ ├── Json.scala │ ├── Node.scala │ ├── Pickling.scala │ ├── PrettyPrinter.scala │ └── Rewriter.scala │ ├── parser │ ├── FastParser.scala │ ├── complex-lit-dfa.svg │ ├── oneplusone-dfa.svg │ └── onestar-dfa.svg │ └── test │ ├── ast │ ├── AstTestDefProvider.scala │ └── PrettyPrinterTestDefProvider.scala │ └── parser │ └── FastParserTestDefProvider.scala ├── project ├── Distros.scala ├── ProjectInfo.scala ├── build.properties ├── build.sbt └── plugins.sbt ├── readme.md ├── resources ├── distro │ ├── dmgbuild-settings.py │ ├── icons │ │ ├── Logo_welcomeScreen.png │ │ ├── Logo_welcomeScreen@2x.png │ │ ├── Logo_welcomeScreen_CE.png │ │ ├── Logo_welcomeScreen_CE@2x.png │ │ ├── icon.png │ │ ├── icon@2x.png │ │ ├── icon_128.png │ │ ├── icon_CE.png │ │ ├── icon_CE@2x.png │ │ ├── icon_CE_128.png │ │ ├── icon_CE_128@2x.png │ │ ├── icon_CE_256.png │ │ ├── icon_CE_256@2x.png │ │ ├── icon_CE_512.png │ │ ├── icon_CE_512@2x.png │ │ ├── icon_CE_64.png │ │ ├── icon_CE_64@2x.png │ │ ├── icon_CEsmall.png │ │ ├── icon_CEsmall@2x.png │ │ ├── icon_small.png │ │ ├── icon_small@2x.png │ │ ├── icon_small@2x_dark.png │ │ ├── icon_small_dark.png │ │ ├── idea-dev.icns │ │ ├── idea-dev.ico │ │ ├── idea-dev.png │ │ ├── idea.icns │ │ ├── idea.png │ │ ├── idea_CE.ico │ │ ├── idea_logo_background.png │ │ └── idea_logo_welcome.png │ ├── idea │ ├── idea.bat │ ├── idea64.bat │ ├── images │ │ ├── dev │ │ │ ├── idea-ce-eap.svg │ │ │ ├── idea-ce.svg │ │ │ ├── idea_community_about.png │ │ │ ├── idea_community_about@2x.png │ │ │ ├── idea_community_logo.png │ │ │ └── idea_community_logo@2x.png │ │ ├── dmg-background.png │ │ ├── idea-ce-eap.svg │ │ ├── idea-ce.svg │ │ ├── idea_community_about.png │ │ ├── idea_community_about@2x.png │ │ ├── idea_community_logo.png │ │ └── idea_community_logo@2x.png │ └── sireum.bat ├── docker │ ├── Dockerfile │ ├── Dockerfile-compcert │ ├── build-compcert.sh │ ├── build.sh │ └── clean.sh └── images │ ├── 01-sireum-ive.png │ ├── 02-import-project.png │ ├── 03-import-config.png │ ├── 04-import-modules.png │ └── sireum-v3-idea-mac64.dmg.png ├── sireum ├── test ├── js │ └── src │ │ └── main │ │ └── scala │ │ └── org │ │ └── sireum │ │ └── test │ │ └── UTestTestFramework.scala ├── jvm │ └── src │ │ └── main │ │ └── scala │ │ └── org │ │ └── sireum │ │ └── test │ │ └── JUnitTestFramework.scala └── shared │ └── src │ └── main │ └── scala │ └── org │ └── sireum │ └── test │ └── TestFramework.scala ├── versions.properties └── web └── js ├── build.sh ├── dependencies.csv ├── publish.sh ├── src └── main │ ├── resources │ ├── index-dev.html │ ├── index.html │ ├── min-maps │ │ └── vs │ │ │ ├── base │ │ │ └── worker │ │ │ │ └── workerMain.js.map │ │ │ ├── editor │ │ │ ├── editor.main.js.map │ │ │ └── editor.main.nls.js.map │ │ │ └── loader.js.map │ └── min │ │ ├── FileSaver.js │ │ ├── GitHub.js │ │ ├── css │ │ ├── amaran.css │ │ ├── balloon.css │ │ ├── bulma-pulse.css │ │ └── font-awesome.css │ │ ├── fonts │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ └── fontawesome-webfont.woff2 │ │ ├── jquery.amaran.js │ │ ├── jquery.js │ │ ├── jszip.js │ │ └── vs │ │ ├── base │ │ └── worker │ │ │ └── workerMain.js │ │ ├── editor │ │ ├── contrib │ │ │ ├── quickOpen │ │ │ │ └── browser │ │ │ │ │ └── symbol-sprite.svg │ │ │ └── suggest │ │ │ │ └── browser │ │ │ │ ├── String_16x.svg │ │ │ │ └── String_inverse_16x.svg │ │ ├── editor.main.css │ │ ├── editor.main.js │ │ └── editor.main.nls.js │ │ ├── language │ │ └── typescript │ │ │ ├── lib │ │ │ └── typescriptServices.js │ │ │ └── src │ │ │ ├── mode.js │ │ │ └── worker.js │ │ └── loader.js │ └── scala │ ├── ffi │ ├── Amaran.scala │ ├── FileSaver.scala │ ├── GitHub.scala │ ├── Zip.scala │ └── monaco │ │ ├── Monaco.scala │ │ └── package.scala │ └── org │ └── sireum │ └── web │ ├── Main.scala │ ├── playground │ ├── Files.scala │ ├── GitHub.scala │ ├── Playground.scala │ └── Z3.scala │ └── ui │ ├── Modal.scala │ └── Notification.scala └── view.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto !eol 2 | *.sh text eol=lf 3 | *.bat text eol=crlf 4 | /sireum text eol=lf 5 | -------------------------------------------------------------------------------- /.github/workflows/CI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push] 4 | 5 | jobs: 6 | 7 | ci-ubuntu: 8 | runs-on: ubuntu-latest 9 | if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip action]')" 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2 13 | - name: Cache Java 14 | id: cache-java 15 | uses: actions/cache@v2 16 | with: 17 | path: platform/java 18 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-java 19 | - name: Cache Z3 20 | id: cache-z3 21 | uses: actions/cache@v2 22 | with: 23 | path: apps/z3 24 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-z3 25 | - name: Cache Scala 26 | id: cache-scala 27 | uses: actions/cache@v2 28 | with: 29 | path: platform/scala 30 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-scala 31 | - name: Cache Node 32 | id: cache-node 33 | uses: actions/cache@v2 34 | with: 35 | path: platform/node 36 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-node 37 | - name: Cache sbt 38 | id: cache-sbt 39 | uses: actions/cache@v2 40 | with: 41 | path: platform/sbt 42 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-sbt 43 | - name: Test 44 | run: | 45 | cd $GITHUB_WORKSPACE 46 | git submodule update --init --recursive 47 | bin/sbt-launch.sh clean test:compile test:fastOptJS 48 | SIREUM_PARALLEL_BUILD=false bin/sbt-launch.sh 'project sireum-jvm' test 49 | 50 | ci-mac: 51 | runs-on: macOS-latest 52 | if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip action]')" 53 | steps: 54 | - name: Checkout 55 | uses: actions/checkout@v2 56 | - name: Cache Java 57 | id: cache-java 58 | uses: actions/cache@v2 59 | with: 60 | path: platform/java 61 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-java 62 | - name: Cache Z3 63 | id: cache-z3 64 | uses: actions/cache@v2 65 | with: 66 | path: apps/z3 67 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-z3 68 | - name: Cache Scala 69 | id: cache-scala 70 | uses: actions/cache@v2 71 | with: 72 | path: platform/scala 73 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-scala 74 | - name: Cache Node 75 | id: cache-node 76 | uses: actions/cache@v2 77 | with: 78 | path: platform/node 79 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-node 80 | - name: Cache sbt 81 | id: cache-sbt 82 | uses: actions/cache@v2 83 | with: 84 | path: platform/sbt 85 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-sbt 86 | - name: Test 87 | run: | 88 | cd $GITHUB_WORKSPACE 89 | git submodule update --init --recursive 90 | bin/sbt-launch.sh clean test:compile test:fastOptJS 91 | SIREUM_PARALLEL_BUILD=false bin/sbt-launch.sh 'project sireum-jvm' test 92 | 93 | ci-windows: 94 | runs-on: windows-latest 95 | if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip action]')" 96 | steps: 97 | - name: Checkout 98 | uses: actions/checkout@v2 99 | - name: Install Cygwin 100 | shell: cmd 101 | run: | 102 | choco config get cacheLocation 103 | choco install --no-progress cygwin 104 | C:\tools\cygwin\cygwinsetup.exe -qgnNdO -R C:/tools/cygwin -s http://mirrors.kernel.org/sourceware/cygwin/ -P bc,unzip,wget 105 | - name: Cache Java 106 | id: cache-java 107 | uses: actions/cache@v2 108 | with: 109 | path: platform/java 110 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-java 111 | - name: Cache Z3 112 | id: cache-z3 113 | uses: actions/cache@v2 114 | with: 115 | path: apps/z3 116 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-z3 117 | - name: Cache Scala 118 | id: cache-scala 119 | uses: actions/cache@v2 120 | with: 121 | path: platform/scala 122 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-scala 123 | - name: Cache Node 124 | id: cache-node 125 | uses: actions/cache@v2 126 | with: 127 | path: platform/node 128 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-node 129 | - name: Cache sbt 130 | id: cache-sbt 131 | uses: actions/cache@v2 132 | with: 133 | path: platform/sbt 134 | key: ${{ runner.os }}-${{ hashFiles('bin/prelude.sh') }}-sbt 135 | - name: Test 136 | shell: cmd 137 | run: | 138 | set PATH=C:\tools\cygwin\bin;C:\tools\cygwin\usr\bin;%PATH% 139 | cd /d %GITHUB_WORKSPACE% 140 | git submodule update --init --recursive 141 | bash -lc "$GITHUB_WORKSPACE/bin/sbt-launch.sh clean test:compile test:fastOptJS" 142 | bash -lc "SIREUM_PARALLEL_BUILD=false $GITHUB_WORKSPACE/bin/sbt-launch.sh 'project sireum-jvm' test" 143 | 144 | skip: 145 | runs-on: ubuntu-latest 146 | if: "contains(github.event.head_commit.message, '[skip ci]') || contains(github.event.head_commit.message, '[skip action]')" 147 | steps: 148 | - run: | 149 | echo Skipped 150 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bsp 2 | /.idea 3 | /bin/VER 4 | /bin/sireum.jar 5 | /apps 6 | /platform 7 | /sbt 8 | /lib_managed 9 | /project/project 10 | /distros/sireum-v3 11 | /distros/*.zip 12 | /distros/*.dmg 13 | /distros/*.exe 14 | /distros/*.tar.gz 15 | /distros/sireum-v3-VER 16 | /distros/sireum-v3-dev-VER 17 | /distros/idea 18 | /.idea/workspace.xml 19 | /.idea/tasks.xml 20 | /.idea/dictionaries 21 | /.idea/dataSources.ids 22 | /.idea/dataSources.xml 23 | /.idea/sqlDataSources.xml 24 | /.idea/dynamic.xml 25 | /.idea/uiDesigner.xml 26 | target 27 | .readme.md.html 28 | .DS_Store 29 | .cache* 30 | .scala_dependencies 31 | project-dependency.dot 32 | *.class 33 | .project 34 | .classpath 35 | .settings 36 | /awas 37 | resource_hacker 38 | /resources/distro/resource_hacker.zip 39 | Scratch.scala 40 | Scratch.sc 41 | scratch.scala 42 | scratch.sc 43 | /web/js/playground 44 | /aadl 45 | out 46 | package-lock.json 47 | node_modules 48 | package.json 49 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "distros/wsd.js"] 2 | path = resources/distro/wsd.js 3 | url = https://github.com/sireum/v3-wsd.js 4 | [submodule "util"] 5 | path = util 6 | url = https://github.com/sireum/v3-util 7 | [submodule "logika"] 8 | path = logika 9 | url = https://github.com/sireum/v3-logika 10 | -------------------------------------------------------------------------------- /.scalafmt.conf: -------------------------------------------------------------------------------- 1 | style = default 2 | 3 | align = none 4 | 5 | encoding = UTF-8 6 | 7 | maxColumn = 120 8 | 9 | assumeStandardLibraryStripMargin = true 10 | 11 | includeCurlyBraceInSelectChains = false 12 | 13 | continuationIndent { 14 | callSite = 2 15 | defnSite = 2 16 | extendSite = 4 17 | } 18 | 19 | danglingParentheses = true 20 | 21 | newlines { 22 | alwaysBeforeTopLevelStatements = true 23 | sometimesBeforeColonInMethodReturnType = false 24 | penalizeSingleSelectMultiArgList = false 25 | alwaysBeforeElseAfterCurlyIf = false 26 | neverInResultType = false 27 | } 28 | 29 | spaces { 30 | afterKeywordBeforeParen = true 31 | } 32 | 33 | binPack { 34 | parentConstructors = true 35 | literalArgumentLists = true 36 | } 37 | 38 | optIn { 39 | breaksInsideChains = false 40 | breakChainOnFirstMethodDot = false 41 | configStyleArguments = false 42 | } 43 | 44 | runner { 45 | optimizer { 46 | # Set to -1 to disable. Increase number to require bigger argument bodies to trigget flag 47 | # presumably, this number is number of characters. 48 | forceConfigStyleOnOffset = 150 49 | 50 | # minimum number of func arguments before config-style (look at top of file) is enabled 51 | forceConfigStyleMinArgCount = 2 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /bin/detect-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2016, Robby, Kansas State University 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # 1. Redistributions of source code must retain the above copyright notice, this 10 | # list of conditions and the following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, 12 | # this list of conditions and the following disclaimer in the documentation 13 | # and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | set -e 27 | SIREUM_HOME=$( cd "$( dirname "$0" )"/.. &> /dev/null && pwd ) 28 | cd ${SIREUM_HOME} 29 | /bin/bash bin/prelude.sh 30 | SIREUM_JAR=${SIREUM_HOME}/bin/sireum.jar 31 | SIREUM_VERSION=$( git log -n 1 --pretty=format:"%H" ) 32 | grep -q ${SIREUM_VERSION} bin/VER &> /dev/null && SIREUM_UPDATE=false || SIREUM_UPDATE=true 33 | SBT=bin/sbt-launch.sh 34 | if [ "${SIREUM_SKIP_BUILD}" != "true" ]; then 35 | if [ ! -f ${SIREUM_JAR} ]; then 36 | echo "Please wait while building Sireum; this might take a while..." 37 | (export SIREUM_RELEASE=true; export SIREUM_PARALLEL_BUILD=false; ${SBT} clean assembly > /dev/null) 38 | echo 39 | echo "${SIREUM_VERSION}" > bin/VER 40 | elif [ "${SIREUM_UPDATE}" = true ]; then 41 | echo "New changes detected; please wait while re-building Sireum..." 42 | (export SIREUM_RELEASE=true; export SIREUM_PARALLEL_BUILD=false; ${SBT} clean assembly > /dev/null) 43 | echo 44 | echo "${SIREUM_VERSION}" > bin/VER 45 | else 46 | CHANGES="$(git status -s)" 47 | if [[ "${CHANGES}" == *.scala* ]] || [[ "${CHANGES}" == *.java* ]] || [[ "${CHANGES}" == *.stg* ]]; then 48 | echo "Local source changes detected; please wait while re-building Sireum..." 49 | (export SIREUM_RELEASE=true; export SIREUM_PARALLEL_BUILD=false; ${SBT} clean assembly > /dev/null) 50 | echo 51 | echo "${SIREUM_VERSION}" > bin/VER 52 | fi 53 | fi 54 | fi 55 | -------------------------------------------------------------------------------- /bin/sbt-launch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015, Robby, Kansas State University 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # 1. Redistributions of source code must retain the above copyright notice, this 10 | # list of conditions and the following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, 12 | # this list of conditions and the following disclaimer in the documentation 13 | # and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | set -e 27 | export SIREUM_HOME=$( cd "$( dirname "$0" )"/.. &> /dev/null && pwd ) 28 | PRELUDE=${SIREUM_HOME}/bin/prelude.sh 29 | ${SIREUM_HOME}/bin/prelude.sh 30 | JAVA=${SIREUM_HOME}/platform/java/bin/java 31 | NODE_BIN=${SIREUM_HOME}/platform/node/bin 32 | Z3=${SIREUM_HOME}/apps/z3/bin/z3 33 | if [ ! -x ${JAVA} ] || [ ! -f ${SBT_JAR} ] || [ ! -d ${NODE_BIN} ] || [ ! -x ${Z3} ]; then 34 | >&2 echo "Could not find ${JAVA}, ${SBT_JAR}, ${NODE_BIN}, or ${Z3}." 35 | exit 1 36 | fi 37 | PATH=${NODE_BIN}:${PATH} 38 | if [[ -z $JVM_OPTS ]]; then 39 | export JVM_OPTS="-Xmx4G -XX:+UseG1GC -XX:ReservedCodeCacheSize=1G -Xss4m" 40 | fi 41 | cd ${SIREUM_HOME} 42 | for i in "$@" ; do 43 | if [[ ${i} == "clean" ]]; then 44 | rm -fR `find . -path "*/target/scala-2.??"` 45 | rm -fR `find . -path "*/target/streams"` 46 | rm -fR `find . -path "*/target/resolution-cache"` 47 | break 48 | fi 49 | done 50 | if [[ $(uname -s) == CYGWIN* ]]; then 51 | SBT_JAR=$( cygpath -C OEM -aw ${SIREUM_HOME}/platform/sbt/bin/sbt-launch.jar ) 52 | export SIREUM_HOME=$( cygpath -C OEM -aw ${SIREUM_HOME} ) 53 | else 54 | SBT_JAR=${SIREUM_HOME}/platform/sbt/bin/sbt-launch.jar 55 | fi 56 | ${JAVA} ${JVM_OPTS} -Dfile.encoding=UTF-8 -Dsbt.io.implicit.relative.glob.conversion=allow -jar ${SBT_JAR} "$@" 57 | -------------------------------------------------------------------------------- /bin/sbt-release-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015, Robby, Kansas State University 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # 1. Redistributions of source code must retain the above copyright notice, this 10 | # list of conditions and the following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, 12 | # this list of conditions and the following disclaimer in the documentation 13 | # and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | SCRIPT_HOME=$( cd "$( dirname "$0" )" &> /dev/null && pwd ) 27 | SIREUM_RELEASE=true ${SCRIPT_HOME}/sbt-launch.sh clean compile test:compile test 28 | 29 | -------------------------------------------------------------------------------- /bin/util-reflect-gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2015, Robby, Kansas State University 4 | # All rights reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are met: 8 | # 9 | # 1. Redistributions of source code must retain the above copyright notice, this 10 | # list of conditions and the following disclaimer. 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, 12 | # this list of conditions and the following disclaimer in the documentation 13 | # and/or other materials provided with the distribution. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 19 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # 26 | SCRIPT_HOME=$( cd "$( dirname "$0" )" &> /dev/null && pwd ) 27 | SIREUM_HOME=$( cd "$( dirname "$0" )"/.. &> /dev/null && pwd ) 28 | /bin/bash ${SCRIPT_HOME}/sbt-launch.sh assembly 29 | if [[ $(uname -s) == CYGWIN* ]]; then 30 | SIREUM_JAR=$( cygpath -C OEM -aw ${SIREUM_HOME}/bin/sireum.jar ) 31 | export SIREUM_HOME=$( cygpath -C OEM -aw ${SIREUM_HOME} ) 32 | else 33 | SIREUM_JAR=${SIREUM_HOME}/bin/sireum.jar 34 | fi 35 | SIREUM="${SIREUM_HOME}/platform/java/bin/java -cp ${SIREUM_JAR} org.Sireum" 36 | ${SIREUM} util reflect json -d ${SIREUM_HOME}/util/shared/src/main/scala -c org.sireum.util.TagJson -l ${SIREUM_HOME}/license.txt org.sireum.util.Tag 37 | ${SIREUM} util reflect rewriter -d ${SIREUM_HOME}/pilar/shared/src/main/scala -c org.sireum.pilar.ast.Rewriter -l ${SIREUM_HOME}/license.txt org.sireum.pilar.ast.Node 38 | ${SIREUM} util reflect json -d ${SIREUM_HOME}/pilar/shared/src/main/scala -c org.sireum.pilar.ast.Json -l ${SIREUM_HOME}/license.txt org.sireum.pilar.ast.Node 39 | ${SIREUM} util reflect cli -c org.sireum.Cli -d ${SIREUM_HOME}/cli/jvm/src/main/scala -l ${SIREUM_HOME}/license.txt org.sireum.option.SireumOption 40 | ${SIREUM} util reflect json -d ${SIREUM_HOME}/java/jvm/src/main/scala -c org.sireum.java.meta.JavaMetaJson -l ${SIREUM_HOME}/license.txt org.sireum.java.meta.JavaMeta 41 | ${SIREUM} util reflect rewriter -d ${SIREUM_HOME}/logika/jvm/src/main/scala -c org.sireum.logika.ast.Rewriter -l ${SIREUM_HOME}/license.txt org.sireum.logika.ast.Node 42 | ${SIREUM} util reflect json -d ${SIREUM_HOME}/logika/shared/src/main/scala -c org.sireum.logika.message.InputMessageJson -l ${SIREUM_HOME}/license.txt org.sireum.logika.message.InputMessage 43 | ${SIREUM} util reflect json -d ${SIREUM_HOME}/logika/shared/src/main/scala -c org.sireum.logika.message.OutputMessageJson -l ${SIREUM_HOME}/license.txt -i "org.sireum.util,org.sireum.util.TagJson" org.sireum.logika.message.OutputMessage 44 | /bin/bash ${SCRIPT_HOME}/sbt-launch.sh assembly 45 | -------------------------------------------------------------------------------- /cli/jvm/src/main/resources/org/sireum/util/reflect/RewriterJsonGen.stg: -------------------------------------------------------------------------------- 1 | mainRewriter(license, packageName, name, rootClassFullName, entry, impor) ::= << 2 | %if(license)% 3 | /* 4 | %license% 5 | */ 6 | 7 | %endif% 8 | // @formatter:off 9 | // This file was auto-generated from %rootClassFullName% 10 | 11 | %if(packageName)% 12 | package %packageName% 13 | 14 | %endif% 15 | import org.sireum.util._ 16 | 17 | object %name% { 18 | import org.sireum.util.Rewriter._ 19 | 20 | val constructorMap : ConstructorMap = Map( 21 | %entry; separator=",\n"% 22 | )%if(impor)%++ %impor; separator=".constructorMap ++ "%.constructorMap%endif% 23 | 24 | def build[T](mode: TraversalMode.Type = TraversalMode.TOP_DOWN)( 25 | f: RewriteFunction) = 26 | org.sireum.util.Rewriter.build[T](constructorMap)(mode, f) 27 | 28 | def buildEnd[T](mode: TraversalMode.Type = TraversalMode.TOP_DOWN)( 29 | f: RewriteFunction, g: RewriteFunction) = 30 | org.sireum.util.Rewriter.buildEnd[T](constructorMap)(mode, f, g) 31 | } 32 | >> 33 | 34 | mainJson(license, packageName, name, rootClassName, rootClassFullName, fromCase, toCase, impor, hasExtern) ::= << 35 | %if(license)% 36 | /* 37 | %license% 38 | */ 39 | 40 | %endif% 41 | // @formatter:off 42 | // This file was auto-generated from %rootClassFullName% 43 | 44 | %if(packageName)% 45 | package %packageName% 46 | 47 | %endif% 48 | import upickle.Js 49 | import org.sireum.util.Json._ 50 | %if(impor)%import %impor; separator="._\nimport "%._%endif% 51 | 52 | object %name% { 53 | %if(hasExtern)% 54 | type FromExtern = PartialFunction[Any, String] 55 | type ToExtern = PartialFunction[String, Any] 56 | 57 | final val externMap = scala.collection.mutable.Map[String, (FromExtern, ToExtern)]().withDefaultValue((Map(), Map())) 58 | %endif% 59 | 60 | import scala.language.implicitConversions 61 | 62 | implicit def from%rootClassName%(o: %rootClassFullName%): Js.Obj = 63 | o match { 64 | %fromCase; separator="\n"% 65 | } 66 | 67 | implicit def to%rootClassName%[T <: %rootClassFullName%](v: Js.Value): T = 68 | (v: @unchecked) match { 69 | case o: Js.Obj => 70 | (o.value.head._2.asInstanceOf[Js.Str].value match { 71 | %toCase; separator="\n"% 72 | }).asInstanceOf[T] 73 | } 74 | } 75 | >> 76 | 77 | constructorEntry(name, fullName, et, ec) ::= << 78 | ("%name%", { es => 79 | val Seq(%et; separator=", "%) = es 80 | %fullName%(%ec; separator=", "%) 81 | }) 82 | >> 83 | 84 | constructorModuleEntry(name, fullName) ::= << 85 | ("%name%", (_) => %fullName%) 86 | >> 87 | 88 | caseFrom(name, fullName, arg) ::= << 89 | case o: %fullName% => 90 | Js.Obj( 91 | (".class", Js.Str("%name%")), 92 | %arg; separator=",\n"% 93 | ) 94 | >> 95 | 96 | caseModuleFrom(name, fullName) ::= << 97 | case %fullName% => 98 | Js.Obj((".class", Js.Str("%name%"))) 99 | >> 100 | 101 | caseFromArg(name, type, arg) ::= << 102 | ("%name%", %type%(o.%name%)%if(arg)%(%arg; separator=", "%)%endif%) 103 | >> 104 | 105 | caseFromExternArg(name, className) ::= << 106 | ("%name%", fromStr(externMap("%className%")._1(o.%name%))) 107 | >> 108 | 109 | caseTo(name, fullName, arg) ::= << 110 | case "%name%" => 111 | %fullName%(%arg; separator=", "%) 112 | >> 113 | 114 | caseModuleTo(name, fullName) ::= << 115 | case "%name%" => %fullName% 116 | >> 117 | 118 | caseToArg(type, i, arg) ::= << 119 | %type%(o.value.toSeq(%i%)._2)%if(arg)%(%arg; separator=", "%)%endif% 120 | >> 121 | 122 | caseToExternArg(i, className) ::= << 123 | externMap("%className%")._2(toStr(o.value.toSeq(%i%)._2)) 124 | >> -------------------------------------------------------------------------------- /cli/jvm/src/main/scala/org/Sireum.scala: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015, Robby, Kansas State University 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package org 27 | 28 | import java.io.File 29 | import java.nio.file.Files 30 | 31 | import org.sireum.option._ 32 | import org.sireum.util._ 33 | import org.yaml.snakeyaml.{TypeDescription, Yaml} 34 | import org.yaml.snakeyaml.constructor.Constructor 35 | import org.yaml.snakeyaml.nodes.Tag 36 | import org.yaml.snakeyaml.representer.Representer 37 | 38 | object Sireum { 39 | private var topOption: Option[SireumOption] = None 40 | 41 | def main(args: Array[String]): Unit = { 42 | import org.sireum.Cli._ 43 | 44 | val optionOpt = { 45 | val f = 46 | Option(System.getProperty("sireum.option")) match { 47 | case Some(p) => 48 | new File(p.trim) 49 | case _ => 50 | val dir = new File(this.getClass.getProtectionDomain.getCodeSource. 51 | getLocation.toURI.getPath).getParentFile 52 | new File(dir, "sireum.yaml") 53 | } 54 | try { 55 | if (!f.isFile) None 56 | else { 57 | val s = new String(Files.readAllBytes(f.toPath)) 58 | val option = yamlLoad[SireumOption](s) 59 | Some(option) 60 | } 61 | } catch { 62 | case t: Throwable => 63 | ePrintln(s"Error loading option from: '${f.getAbsolutePath}'") 64 | oPrintln("Falling back to default option") 65 | None 66 | } 67 | } 68 | val option = optionOpt.getOrElse(SireumOption()) 69 | topOption = Some(option) 70 | new org.sireum.Cli(oPrintln, ePrintln).parseSireumOption(args, 0, option) 71 | topOption = None 72 | } 73 | 74 | def run(option: UtilOptionOption, 75 | outPrintln: String => Unit, 76 | errPrintln: String => Unit): Boolean = { 77 | outPrintln(yamlDump(topOption.getOrElse(SireumOption()))) 78 | false 79 | } 80 | 81 | private def yamlDump(o: AnyRef): String = { 82 | val r = new Representer 83 | r.addClassTag(classOf[some[_]], new Tag("!some")) 84 | r.addClassTag(classOf[none[_]], new Tag("!none")) 85 | val s = new Yaml(new Constructor(classOf[SireumOption]), r).dump(o) 86 | s.substring(s.indexOf('\n') + 1).trim 87 | } 88 | 89 | private def yamlLoad[T](s: String): T = { 90 | val c = new Constructor(classOf[SireumOption]) 91 | c.addTypeDescription(new TypeDescription(classOf[some[_]], "!some")) 92 | c.addTypeDescription(new TypeDescription(classOf[none[_]], "!none")) 93 | new Yaml(c).load(s).asInstanceOf[T] 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /cli/jvm/src/main/scala/org/sireum/cli/.gitignore: -------------------------------------------------------------------------------- 1 | /sireum -------------------------------------------------------------------------------- /cli/jvm/src/main/scala/org/sireum/cli/CliConfig.sc: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2018, Robby, Kansas State University 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ { 25 | 26 | import org.sireum._ 27 | import org.sireum.cli.CliOpt._ 28 | 29 | val logikaTool: Tool = Tool( 30 | name = "logika", 31 | command = "logika", 32 | description = "Logika verifier and proof checker", 33 | header = 34 | st"""Sireum/Logika: 35 | |A Program Verifier and A Natural Deduction Proof Checker 36 | |... for Propositional, Predicate, and Programming Logics""".render, 37 | usage = "