Skip to content

Commit

Permalink
Merge branch 'release/0.3.3-RC1'
Browse files Browse the repository at this point in the history
  • Loading branch information
bishabosha committed Aug 12, 2019
2 parents e03ffb5 + 23b6f1a commit 564fa01
Show file tree
Hide file tree
Showing 30 changed files with 1,397 additions and 1,426 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.3.3-RC1] - 2019-08-13
### Changed
- Upgrade Dotty to `0.17.0-RC1`

## [0.3.2-RC1] - 2019-07-24
### Changed
- Upgrade Dotty to `0.16.0-RC3`
Expand Down Expand Up @@ -102,7 +106,8 @@ All notable changes to this project will be documented in this file.
- Source files use `.hs` suffix at present to benefit from syntax highlighting.
- Refer to [eec/src/main/antlr4/EEC.g4](eec/src/main/antlr4/EEC.g4) for a context free grammar.

[Unreleased]: https://github.com/bishabosha/EEC/compare/0.3.2-RC1...develop
[Unreleased]: https://github.com/bishabosha/EEC/compare/0.3.3-RC1...develop
[0.3.3-RC1]: https://github.com/bishabosha/EEC/releases/tag/0.3.3-RC1
[0.3.2-RC1]: https://github.com/bishabosha/EEC/releases/tag/0.3.2-RC1
[0.3.1-RC3]: https://github.com/bishabosha/EEC/releases/tag/0.3.1-RC3
[0.3.0-RC1]: https://github.com/bishabosha/EEC/releases/tag/0.3.0-RC1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Mesa

### Current Release
0.3.2-RC1
0.3.3-RC1

## About
This repository is for implementing a programming language based on the enriched effect calculus by Egger, Ejlers and Simpson (2014).
Expand Down
4 changes: 2 additions & 2 deletions eec/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Mesa 0.3.2-RC1
# Mesa 0.3.3-RC1

## Requirements
* sbt 1.2.8
* Dotty 0.16.0-RC3 <http://dotty.epfl.ch>
* Dotty 0.17.0-RC1 <http://dotty.epfl.ch>

## Usage

Expand Down
4 changes: 2 additions & 2 deletions eec/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
val dottyVersion = "0.16.0-RC3"
val dottyVersion = "0.17.0-RC1"
// val dottyVersion = dottyLatestNightlyBuild.get

enablePlugins(Antlr4Plugin)
Expand All @@ -11,7 +11,7 @@ lazy val root = project
.in(file("."))
.settings(
name := "mesa-core",
version := "0.3.2-RC1",
version := "0.3.3-RC1",

compileOrder := CompileOrder.JavaThenScala,

Expand Down
6 changes: 2 additions & 4 deletions eec/src/main/scala/eec/Main.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package eec

import repl._

object Main {

def main(args: Array[String]): Unit = {
Expand All @@ -12,9 +10,9 @@ object Main {
println(" -p => modifier for -e to load the REPL with Prelude definitions.")
println(" -help => view these options")
} else if args `sameElements` Array("-e") then {
Repl.loop(false)
repl.loop(false)
} else if args.toSet == Set("-e", "-p") then {
Repl.loop(true)
repl.loop(true)
} else {
println("No valid option specified. See options with -help")
}
Expand Down
17 changes: 8 additions & 9 deletions eec/src/main/scala/eec/compiler/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import Modifiers._
import types.Types._
import untyped.nt
import annotation._
import util.{Show, Utils}
import Utils.{eval, foldMap}
import util.{ Show, eval, foldMap }

import delegate Meta.TreeOps._
import delegate Names.NameOps._
import delegate TypeOps._
import given Meta.TreeOps._
import given Names.NameOps._
import given TypeOps._

object Trees {
import Tree._
Expand Down Expand Up @@ -139,27 +138,27 @@ object Trees {
case _ => Id.empty
}

delegate for Show[Tree] = t => pprint.apply(
given as Show[Tree] = t => pprint.apply(
x = (t: Meta.Tree),
width = 80,
height = Int.MaxValue
).render

delegate for Conversion[Tree, List[Tree]] = {
given as Conversion[Tree, List[Tree]] = {
case EmptyTree => Nil
case TreeSeq(args) => args
case Parens(args) => args
case Alternative(args) => args
case t => t :: Nil
}

delegate for Conversion[List[Tree], Tree] = {
given as Conversion[List[Tree], Tree] = {
case Nil => EmptyTree
case t :: Nil => t
case ts => TreeSeq(ts)
}

delegate uniqName for Conversion[Tree, Name] = {
given uniqName as Conversion[Tree, Name] = {
case DefSig(name, _) => name
case LinearSig(name, _, _) => name
case DefDef(_, sig, _, _) => sig
Expand Down
1 change: 0 additions & 1 deletion eec/src/main/scala/eec/compiler/core/Constants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ object Constants {
type ConstantScala = Boolean | BigDecimal | BigInt | String | Char

object Constant {
def BooleanConstant(z: Boolean): Constant = z
def BigDecConstant(bd: BigDecimal): Constant = bd
def BigIntConstant(bi: BigInt): Constant = bi
def StringConstant(str: String): Constant = str
Expand Down
2 changes: 1 addition & 1 deletion eec/src/main/scala/eec/compiler/core/ContextErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Names._
import Contexts.Id
import error.CompilerErrors._

import delegate NameOps._
import given NameOps._

object ContextErrors {

Expand Down
56 changes: 30 additions & 26 deletions eec/src/main/scala/eec/compiler/core/Contexts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ import types.Types
import Types._
import Type._
import TypeOps._
import util.{Show, Utils}
import util.{Show, view}
import core.{ContextErrors => Err}
import Utils._

import delegate NameOps._
import delegate TypeOps._
import given NameOps._
import given TypeOps._

object Contexts {
import Mode._
Expand All @@ -35,7 +34,6 @@ object Contexts {
type Modal[X] = given Mode => X
type Contextual[O] = given Context => O
type IdReader[O] = given IdGen => O
opaque type Id = Long

enum Mode derives Eql {
case Typing, Term, Pat, PatAlt, LinearPat
Expand All @@ -58,19 +56,30 @@ object Contexts {
}

object ModeOps {
delegate for Show[Mode] = {
given as Show[Mode] = {
case LinearPat => "linear pattern"
case Pat | PatAlt => "pattern"
case Term => "term"
case Typing => "typing"
}
}

object opaques {
opaque type Id = Long
inline val one: Id = 1l
inline val zero: Id = 0l
inline val noId: Id = -1l
def (x: Id) + (y: Id): Id = x + y
}

type Id = opaques.Id

object Id {
private[Contexts] val rootId: Id = 0l
val empty: Id = -1l
val init: Id = 1l
def (x: Id) succ : Id = x + 1l
import opaques._
private[Contexts] val rootId: Id = zero
val init: Id = one
val empty: Id = noId
inline def (x: Id) succ : Id = x + one
}

final class IdGen {
Expand Down Expand Up @@ -141,9 +150,8 @@ object Contexts {
}

def removeFromCtx(id: Id) given Context: Unit = {
for (mapping <- symFor(id) if id != Id.empty) {
for mapping <- symFor(id) if id != Id.empty do
ctx.termScope -= mapping
}
}

def rootCtx given Context = {
Expand All @@ -158,7 +166,7 @@ object Contexts {
private def firstTermCtx(name: Name) given Context: Lifted[Context] = {
@tailrec
def inner(current: Context): Lifted[Context] = {
delegate for Context = current
given as Context = current
if isLinearOrInScope(name) then
ctx
else ctx match {
Expand All @@ -173,7 +181,7 @@ object Contexts {
private def firstTypeCtx(name: Name) given Context: Lifted[Context] = {
@tailrec
def inner(current: Context): Lifted[Context] = {
delegate for Context = current
given as Context = current
if isData(name) then
ctx
else ctx match {
Expand All @@ -187,14 +195,14 @@ object Contexts {

def lookupType(name: Name) given Context: Lifted[Type] = {
firstTypeCtx(name).flatMap { ctx =>
delegate for Context = ctx
given as Context = ctx
dataType(name)
}
}

def lookupConstructors(data: Name) given Context: Lifted[List[(Name, Type)]] = {
firstTypeCtx(data).flatMap { ctx =>
delegate for Context = ctx
given as Context = ctx
constructorsFor(data)
}
}
Expand All @@ -212,7 +220,7 @@ object Contexts {
for
ctx1 <- firstTermCtx(name)
o <- lift {
delegate for Context = ctx1
given as Context = ctx1
onFound
}
yield o
Expand All @@ -227,7 +235,7 @@ object Contexts {
def isDataDeep(name: Name) given Context: Boolean = {
@tailrec
def inner(current: Context): Boolean = {
delegate for Context = current
given as Context = current
isData(name) || {
ctx match {
case ctx: Fresh => inner(ctx.outer)
Expand Down Expand Up @@ -398,13 +406,9 @@ object Contexts {
} else if idGen.current != Id.init then {
Err.noFreshIdGen
} else {
delegate for Context = root
for ((name, tpe) <- bootstrapped.view) {
for _ <- enterData(name)
yield {
putDataType(name -> tpe)
}
}
given as Context = root
for (name, tpe) <- bootstrapped.view do
for _ <- enterData(name) do putDataType(name -> tpe)
}
}

Expand All @@ -415,7 +419,7 @@ object Contexts {
case ctx: Fresh => ctx.outer
}
val parentTpe = lift {
delegate for Context = parentCtx
given as Context = parentCtx
termType(parent)
}
parentTpe.flatMap {
Expand Down
18 changes: 7 additions & 11 deletions eec/src/main/scala/eec/compiler/core/Meta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import Modifiers._
import Contexts._
import types.Types._

import delegate TypeOps._
import given TypeOps._

object Meta {
import Tree._
import Name._
import Context._
import Constant._

import delegate NameOps._
import given NameOps._

enum Name derives Eql {
case From(str: String)
Expand Down Expand Up @@ -75,8 +75,8 @@ object Meta {
}

object NameOps {
import delegate Names.NameOps._
delegate for Conversion[Names.Name, Name] = {
import given Names.NameOps._
given as Conversion[Names.Name, Name] = {
case f: (Names.Name.From | Names.Name.Comp) => From(f.show)
case Names.Name.BangTag => BangTag
case Names.Name.TensorTag => TensorTag
Expand All @@ -94,7 +94,7 @@ object Meta {

object ContextOps {

delegate for Conversion[Contexts.Context, Seq[Context]] {
given as Conversion[Contexts.Context, Seq[Context]] {

def branch(ctx: Contexts.Context): Seq[Context] = {
val linearScopeOpt = {
Expand All @@ -106,11 +106,7 @@ object Meta {
}
yield LinearVariable(name, tpe)
}
val data = {
for
(name, tpe) <- ctx.dataTypeTable
yield Data(name, tpe.define)
}
val data = for (name, tpe) <- ctx.dataTypeTable yield Data(name, tpe.define)
val defs = {
for
pair <- ctx.termScope.filter { pair =>
Expand Down Expand Up @@ -162,7 +158,7 @@ object Meta {
}

object TreeOps {
delegate toTree for Conversion[Trees.Tree, Tree] = {
given toTree as Conversion[Trees.Tree, Tree] = {
case Trees.Tree.Select(tree, name) => Select(toTree(tree), name)
case Trees.Tree.Ident(name) => Ident(name)

Expand Down
Loading

0 comments on commit 564fa01

Please sign in to comment.