-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
250 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
adt `vector`<T> { | ||
pure T vector_loc(`vector`<T> v, int i); | ||
} | ||
|
||
decreases; | ||
requires 0 <= i; | ||
requires i < 4; | ||
pure T v4loc<T>(`vector`<T> a, int i) = `vector`<T>.vector_loc(a, i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/col/vct/col/ast/expr/literal/build/LiteralVectorImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package vct.col.ast.expr.literal.build | ||
|
||
import vct.col.ast.{LiteralVector, TVector, Type} | ||
import vct.col.print.{Ctx, Doc, Group, Precedence, Text} | ||
import vct.col.ast.ops.LiteralVectorOps | ||
|
||
trait LiteralVectorImpl[G] extends LiteralVectorOps[G] { this: LiteralVector[G] => | ||
override def t: Type[G] = TVector(element, values.size) | ||
|
||
override def precedence: Int = Precedence.POSTFIX | ||
override def layout(implicit ctx: Ctx): Doc = | ||
Group(Text("vector<") <> element <> "," <> values.size.toString <> ">{" <> Doc.args(values) <> "}") | ||
} |
12 changes: 12 additions & 0 deletions
12
src/col/vct/col/ast/expr/op/collection/VectorSubscriptImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package vct.col.ast.expr.op.collection | ||
|
||
import vct.col.ast.{VectorSubscript, Type} | ||
import vct.col.print.{Ctx, Doc, Precedence, Group} | ||
import vct.col.ast.ops.VectorSubscriptOps | ||
|
||
trait VectorSubscriptImpl[G] extends VectorSubscriptOps[G] { this: VectorSubscript[G] => | ||
override def t: Type[G] = seq.t.asVector.get.element | ||
|
||
override def precedence: Int = Precedence.POSTFIX | ||
override def layout(implicit ctx: Ctx): Doc = Group(assoc(seq) <> "[" <> Doc.arg(index) <> "]") | ||
} |
8 changes: 8 additions & 0 deletions
8
src/col/vct/col/ast/family/coercion/CoerceMapVectorImpl.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package vct.col.ast.family.coercion | ||
|
||
import vct.col.ast.{CoerceMapVector, TVector} | ||
import vct.col.ast.ops.CoerceMapVectorOps | ||
|
||
trait CoerceMapVectorImpl[G] extends CoerceMapVectorOps[G] { this: CoerceMapVector[G] => | ||
override def target: TVector[G] = TVector(targetVectorElement, size) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package vct.col.ast.`type` | ||
|
||
import vct.col.ast.TVector | ||
import vct.col.ast.ops.TVectorOps | ||
import vct.col.print.{Ctx, Doc, Group, Text} | ||
|
||
trait TVectorImpl[G] extends TVectorOps[G] { this: TVector[G] => | ||
override def layout(implicit ctx: Ctx): Doc = | ||
Group(Text("vector") <> open <> Doc.arg(element) <> "," <> size.toString <> close) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.