Skip to content

Commit

Permalink
updated mill, officially named tool
Browse files Browse the repository at this point in the history
  • Loading branch information
l-kent committed Apr 13, 2020
1 parent a6789b3 commit 67ca579
Show file tree
Hide file tree
Showing 25 changed files with 191 additions and 123 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ out/
*.iml
.idea/
build/
armlogictool.sh

wemelt.sh
38 changes: 19 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@

MILL = ./mill

TOOL_JAVA = tool/src/tool/Parser.java \
tool/src/tool/Scanner.java
WEMELT_JAVA = wemelt/src/wemelt/Parser.java \
wemelt/src/wemelt/Scanner.java

TOOL_JAR = out/tool/jar/dest/out.jar
TOOL_LAUNCHER = ./out/tool/launcher/dest/run
TOOL_SH = ./armlogictool.sh
WEMELT_JAR = out/wemelt/jar/dest/out.jar
WEMELT_LAUNCHER = ./out/wemelt/launcher/dest/run
WEMELT_SH = ./wemelt.sh

all: parser $(TOOL_JAR) $(TOOL_SH) macos_sip_fix
all: parser $(WEMELT_JAR) $(WEMELT_SH) macos_sip_fix

parser: $(TOOL_JAVA)
parser: $(WEMELT_JAVA)

clean:
$(MILL) clean
rm -f $(TOOL_JAVA)
rm -f $(TOOL_SH)
rm -f $(WEMELT_JAVA)
rm -f $(WEMELT_SH)

check-dependencies:
$(MILL) mill.scalalib.Dependency/updates

$(TOOL_LAUNCHER):
$(WEMELT_LAUNCHER):
@echo $@
$(MILL) tool.launcher
$(MILL) wemelt.launcher

$(TOOL_JAR):
$(WEMELT_JAR):
@echo $@
$(MILL) tool.jar
$(MILL) wemelt.jar

$(TOOL_SH): $(TOOL_LAUNCHER)
@echo "[echo] $@"; echo "#!/usr/bin/env bash" > $@; echo "export LD_LIBRARY_PATH=$(PWD)/tool/lib" >> $@; echo "source $(TOOL_LAUNCHER)" >> $@
$(WEMELT_SH): $(WEMELT_LAUNCHER)
@echo "[echo] $@"; echo "#!/usr/bin/env bash" > $@; echo "export LD_LIBRARY_PATH=$(PWD)/wemelt/lib" >> $@; echo "source $(WEMELT_LAUNCHER)" >> $@
@echo "[chmod] $@"; chmod +x $@

%.java: %.grammar
Expand All @@ -39,13 +39,13 @@ $(TOOL_SH): $(TOOL_LAUNCHER)
%.java: %.flex
jflex -nobak $^

o: $(TOOL_OBJ)
@echo $(TOOL_OBJ)
o: $(WEMELT_OBJ)
@echo $(WEMELT_OBJ)

macos_sip_fix: tool/lib/libz3java.dylib tool/lib/libz3.dylib
macos_sip_fix: wemelt/lib/libz3java.dylib wemelt/lib/libz3.dylib
@if [ $$(uname -s) = "Darwin" ]; then \
make -s libz3java.dylib libz3.dylib; \
fi

lib%.dylib: tool/lib/lib%.dylib
lib%.dylib: wemelt/lib/lib%.dylib
ln -s $<
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@

## Building

The tool should build by typing `make` in the top-level directory.
WeMeLT should build by typing `make` in the top-level directory.

```
make
```

This should produce a shell script `armlogictool.sh` for running it.
This should produce a shell script `wemelt.sh` for running it.

## Running

Run `armlogictool.sh`, supplying a list of files to analyse as command line
Run `wemelt.sh`, supplying a list of files to analyse as command line
arguments.

`-v` can be used ato print the P, D, and Gamma values after each statement

`-d` can be used to print additional debug information

```
./armlogictool.sh file1 file2 ..
./armlogictool.sh -v file1 file2 ..
./armlogictool.sh -d file1 file2 ..
./wemelt.sh file1 file2 ..
./wemelt.sh -v file1 file2 ..
./wemelt.sh -d file1 file2 ..
```

## Input file format
Expand Down
4 changes: 2 additions & 2 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import mill._
import mill.scalalib._

object tool extends ScalaModule {
object wemelt extends ScalaModule {
def scalaVersion = "2.12.8"
def mainClass = Some("tool.Tool")
def mainClass = Some("wemelt.WeMeLT")
def unmanagedClasspath = T {
if (!ammonite.ops.exists(millSourcePath / "lib")) Agg()
else Agg.from(ammonite.ops.ls(millSourcePath / "lib").map(PathRef(_)))
Expand Down
2 changes: 1 addition & 1 deletion buildandtest.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
make clean
make
./armlogictool.sh tests/* examples/*
./wemelt.sh tests/* examples/*
5 changes: 2 additions & 3 deletions buildparser.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
jflex -nobak tool/src/tool/Scanner.flex
java -jar beaver.jar -t tool/src/tool/Parser.grammar

jflex -nobak wemelt/src/wemelt/Scanner.flex
java -jar beaver.jar -t wemelt/src/wemelt/Parser.grammar
21 changes: 16 additions & 5 deletions mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This is a wrapper script, that automatically download mill from GitHub release pages
# You can give the required mill version with MILL_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
DEFAULT_MILL_VERSION=0.5.1
DEFAULT_MILL_VERSION=0.6.1

set -e

Expand All @@ -17,13 +17,24 @@ if [ -z "$MILL_VERSION" ] ; then
fi
fi

MILL_DOWNLOAD_PATH="$HOME/.mill/download"
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/$MILL_VERSION"
if [ "x${XDG_CACHE_HOME}" != "x" ] ; then
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download"
else
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download"
fi
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"

version_remainder="$MILL_VERSION"
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"

if [ ! -x "$MILL_EXEC_PATH" ] ; then
mkdir -p $MILL_DOWNLOAD_PATH
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then
ASSEMBLY="-assembly"
fi
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION-assembly"
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION${ASSEMBLY}"
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
chmod +x "$DOWNLOAD_FILE"
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
Expand All @@ -34,4 +45,4 @@ fi
unset MILL_DOWNLOAD_PATH
unset MILL_VERSION

exec $MILL_EXEC_PATH -i "$@"
exec $MILL_EXEC_PATH "$@"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tool/src/tool/Exec.scala → wemelt/src/wemelt/Exec.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tool
package wemelt

// remnant of handling break/continue/returns - might be useful in future
sealed trait Cont {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tool
package wemelt

trait Expression extends beaver.Symbol {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%package "tool";
%package "wemelt";
%class "Parser";

%terminals VAR;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tool;
package wemelt;

import beaver.*;
import java.util.ArrayList;
Expand Down
2 changes: 1 addition & 1 deletion tool/src/tool/SMT.scala → wemelt/src/wemelt/SMT.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tool
package wemelt

import com.microsoft.z3

Expand Down
4 changes: 2 additions & 2 deletions tool/src/tool/Scanner.flex → wemelt/src/wemelt/Scanner.flex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package tool;
package wemelt;

import beaver.Symbol;
import tool.Parser.Terminals;
import wemelt.Parser.Terminals;

%%

Expand Down
Loading

0 comments on commit 67ca579

Please sign in to comment.