Skip to content

Commit

Permalink
Merge pull request #39 from MetaBorgCube/release/0.8.1
Browse files Browse the repository at this point in the history
Release/0.8.1
  • Loading branch information
dcharkes authored Dec 8, 2017
2 parents e2e3c9b + c5c2b51 commit f94a3e8
Show file tree
Hide file tree
Showing 19 changed files with 344 additions and 49 deletions.
4 changes: 2 additions & 2 deletions change_version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROMVERSION=0.7.1
TOVERSION=0.7.2
FROMVERSION=0.7.2
TOVERSION=0.8.1

grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}(.qualifier|-SNAPSHOT)" * | xargs sed -i "" "s/${FROMVERSION}/${TOVERSION}/g"
4 changes: 2 additions & 2 deletions change_version_to_stable.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROMVERSION=0.7.2
TOVERSION=0.8.0
FROMVERSION=0.8.1
TOVERSION=0.8.1

grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}.qualifier" * | xargs sed -i "" "s/${FROMVERSION}.qualifier/${TOVERSION}/g"
grep -rEl --exclude=*/target/* --exclude=*/src-gen/* --include=*.{yaml,xml,MF} "${FROMVERSION}-SNAPSHOT" * | xargs sed -i "" "s/${FROMVERSION}-SNAPSHOT/${TOVERSION}/g"
4 changes: 2 additions & 2 deletions icedust.eclipse.feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<feature
id="icedust.eclipse.feature"
label="icedust language Eclipse plugin"
version="0.8.0"
version="0.8.1"
>
<plugin id="icedust.eclipse" version="0.8.0" unpack="true" />
<plugin id="icedust.eclipse" version="0.8.1" unpack="true" />
<includes id="org.metaborg.spoofax.eclipse.feature" version="0" />
</feature>
2 changes: 1 addition & 1 deletion icedust.eclipse.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust.eclipse.feature</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>eclipse-feature</packaging>

<parent>
Expand Down
2 changes: 1 addition & 1 deletion icedust.eclipse.site/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust.eclipse.site</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>eclipse-update-site</packaging>

<parent>
Expand Down
2 changes: 1 addition & 1 deletion icedust.eclipse.site/site.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/icedust.eclipse.feature_0.8.0.jar" id="icedust.eclipse.feature" version="0.8.0">
<feature url="features/icedust.eclipse.feature_0.8.1.jar" id="icedust.eclipse.feature" version="0.8.1">
<category name="icedust"/>
</feature>
<category-def name="icedust" label="icedust language Eclipse plugin">
Expand Down
2 changes: 1 addition & 1 deletion icedust.eclipse/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: icedust language Eclipse plugin
Bundle-SymbolicName: icedust.eclipse;singleton:=true
Bundle-Version: 0.8.0
Bundle-Version: 0.8.1
Bundle-Vendor: org.metaborg.lang
Bundle-ActivationPolicy: lazy
Require-Bundle: org.metaborg.spoofax.eclipse
Expand Down
2 changes: 1 addition & 1 deletion icedust.eclipse/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust.eclipse</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>eclipse-plugin</packaging>

<parent>
Expand Down
2 changes: 1 addition & 1 deletion icedust.example/metaborg.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
dependencies:
compile:
- org.metaborg.lang:icedust:0.8.0
- org.metaborg.lang:icedust:0.8.1
4 changes: 2 additions & 2 deletions icedust.example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust.example</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>spoofax-project</packaging>

<parent>
Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<type>spoofax-language</type>
</dependency>
</dependencies>
Expand Down
186 changes: 186 additions & 0 deletions icedust.proofs/multiplicities2.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
(*
This is an extension of multiplicities.v with expressions that use environments
Under construction
*)

Require Import List.
Import ListNotations.
Require Import Coq.Init.Nat.
Require Import Coq.Strings.String.
Require Export Coq.FSets.FMapWeakList.
Require Export Coq.Structures.DecidableType.
Module StringEQ <: DecidableType.
Definition t := string.
Definition eq := @eq t.
Definition eq_refl := @refl_equal t.
Definition eq_sym := @sym_eq t.
Definition eq_trans := @trans_eq t.
Definition eq_dec := string_dec.
End StringEQ.
Module M := FMapWeakList.Make(StringEQ).

(***** higher order helper functions *****)
Fixpoint list_pair_with {X Y : Type} (lx : list X) (y : Y) : list (X*Y) :=
match lx with
| [] => []
| x :: tx => (x, y) :: (list_pair_with tx y)
end.

Fixpoint list_pair_with2 {X Y : Type} (x : X) (ly : list Y) : list (X*Y) :=
match ly with
| [] => []
| y :: ty => (x, y) :: (list_pair_with2 x ty)
end.

Fixpoint list_crossproduct {X Y : Type}
(lx : list X) (ly : list Y) : list (X*Y) :=
match lx with
| [] => []
| x :: tx => (list_pair_with2 x ly) ++ (list_crossproduct tx ly)
end.

Fixpoint fmap {A B:Type} (f:A -> option B) (l:list A) : list B :=
match l with
| nil => nil
| cons x t =>
match f x with
| None => (fmap f t)
| Some y => y :: (fmap f t)
end
end.

Fixpoint foldo {A:Type} (f:A->A->A) (l:list A) : option A :=
match l with
| [] => None
| h :: t => Some(fold_left f t h)
end.

Function to_list {X:Type} (v : option X) : list X :=
match v with
| None => []
| Some x => [x]
end.

Function funtuple {X Y Z : Type} (f: X -> Y -> Z) (t:X*Y) : Z :=
match t with
| (v1, v2) => f v1 v2
end.

Function iftuple {X : Type} (t : (bool*(X*X))) : X :=
match t with
| (true, (v2, _ )) => v2
| (false, (_ , v3)) => v3
end.

(***** Signatures *****)
Inductive expr : Type :=
| EInt : nat -> expr
| ETrue : expr
| EFalse : expr
| EAnd : expr -> expr -> expr
| EPlus : expr -> expr -> expr
| EVar : string -> expr
| EFilter : expr -> string -> expr -> expr.

Inductive val : Type :=
| intv : list nat -> val
| boolv : list bool -> val.

Definition env: Type := M.t val.

(***** helper functions *****)
Definition get (m : env) (k : string) :=
M.find k m.

Definition set (m : env) (k : string) (v : val) :=
M.add k v m.

Definition empty :=
M.empty nat.

(***** Interpreter *****)
Reserved Notation "env '|-' e '\\' v"
(at level 50, left associativity).

Inductive evalR : env -> expr -> val -> Prop :=
| E_Int : forall env (n:nat),
env |- EInt n \\ intv [n]

| E_True : forall env,
env |- ETrue \\ boolv [true]

| E_False : forall env,
env |- EFalse \\ boolv [false]

| E_And : forall env (e1 e2 : expr) v1s v2s vtuples,
env |- e1 \\ boolv v1s ->
env |- e2 \\ boolv v2s ->
vtuples = list_crossproduct v1s v2s ->
env |- EAnd e1 e2 \\ boolv (map (funtuple andb) vtuples)

| E_Plus : forall env (e1 e2 : expr) v1s v2s vtuples,
env |- e1 \\ intv v1s ->
env |- e2 \\ intv v2s ->
vtuples = list_crossproduct v1s v2s ->
env |- EPlus e1 e2 \\ intv (map (funtuple plus) vtuples)

| E_Var_Bool : forall env n v1s,
Some (boolv v1s) = get env n ->
env |- EVar n \\ boolv v1s

(* add filter *)

where "env '|-' e '\\' v" := (evalR env e v) : type_scope.

Fixpoint evalF (env : env) (e : expr) : option val :=
match e with
| EInt n =>
Some (intv [n])

| ETrue =>
Some (boolv [true])

| EFalse =>
Some (boolv [false])

| EAnd e1 e2 =>
let v1 := evalF env e1 in
let v2 := evalF env e2 in
match v1, v2 with
| Some (boolv v1s), Some (boolv v2s) =>
let vtuples := list_crossproduct v1s v2s in
let vs := map (funtuple andb) vtuples in
Some (boolv vs)
| _,_ => None
end

| EPlus e1 e2 =>
let v1 := evalF env e1 in
let v2 := evalF env e2 in
match v1, v2 with
| Some (intv v1s), Some (intv v2s) =>
let vtuples := list_crossproduct v1s v2s in
let vs := map (funtuple plus) vtuples in
Some (intv vs)
| _,_ => None
end

| EVar n =>
let v1 := get env n in
v1

| EFilter e1 n e2 => (* implement filter instead of lambda *)
let v1 := evalF env e1 in
match v1 with
| Some (boolv v1s) =>
let env' := set env n (boolv v1s) in (* use fold over elements *)
let v2 := evalF env' e2 in
v2
| Some (intv v1s) =>
let env' := set env n (intv v1s) in
let v2 := evalF env' e2 in
v2
| None => None
end
end.
4 changes: 2 additions & 2 deletions icedust.test/metaborg.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
id: org.metaborg:icedust.test:0.8.0
id: org.metaborg:icedust.test:0.8.1
name: IceDust
dependencies:
compile:
- org.metaborg.lang:icedust:0.8.0
- org.metaborg.lang:icedust:0.8.1
- org.metaborg:org.metaborg.meta.lang.spt:${metaborgVersion}
runtime:
nabl2:
Expand Down
6 changes: 3 additions & 3 deletions icedust.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust.test</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<packaging>spoofax-test</packaging>

<parent>
Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>org.metaborg.lang</groupId>
<artifactId>icedust</artifactId>
<version>0.8.0</version>
<version>0.8.1</version>
<type>spoofax-language</type>
</dependency>
<dependency>
Expand All @@ -39,7 +39,7 @@
<artifactId>spoofax-maven-plugin</artifactId>
<version>${metaborg-version}</version>
<configuration>
<languageUnderTest>org.metaborg.lang:icedust:0.8.0</languageUnderTest>
<languageUnderTest>org.metaborg.lang:icedust:0.8.1</languageUnderTest>
</configuration>
</plugin>
</plugins>
Expand Down
Loading

0 comments on commit f94a3e8

Please sign in to comment.