mirror of
https://github.com/kanaka/mal.git
synced 2024-09-11 13:55:55 +03:00
Swift3: update to Swift 3 Preview 3.
This commit is contained in:
parent
575ca23041
commit
a3a6f68098
@ -58,7 +58,7 @@ matrix:
|
||||
- {env: IMPL=scala, services: [docker]}
|
||||
- {env: IMPL=swift NO_DOCKER=1, os: osx, osx_image: xcode7}
|
||||
- {env: IMPL=swift3, services: [docker]}
|
||||
- {env: IMPL=swift3 NO_DOCKER=1, os: osx, osx_image: xcode7}
|
||||
- {env: IMPL=swift3 NO_DOCKER=1, os: osx, osx_image: xcode8}
|
||||
- {env: IMPL=tcl, services: [docker]}
|
||||
- {env: IMPL=vb, services: [docker]}
|
||||
- {env: IMPL=vhdl, services: [docker]}
|
||||
|
@ -731,8 +731,7 @@ make
|
||||
### Swift 3
|
||||
|
||||
The Swift 3 implementation of mal requires the Swift 3.0 compiler. It
|
||||
has been tested with the development version of the Swift 3 from
|
||||
2016-02-08.
|
||||
has been tested with Swift 3 Preview 3.
|
||||
|
||||
```
|
||||
cd swift3
|
||||
|
@ -27,21 +27,14 @@ RUN apt-get -y install clang-3.6 cmake pkg-config \
|
||||
libbsd-dev libedit-dev libxml2-dev libsqlite3-dev \
|
||||
swig libpython-dev libncurses5-dev
|
||||
|
||||
ENV SWIFT_PREFIX swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a
|
||||
ENV SWIFT_PREFIX swift-3.0-PREVIEW-3
|
||||
ENV SWIFT_RELEASE ${SWIFT_PREFIX}-ubuntu15.10
|
||||
|
||||
RUN cd /opt && \
|
||||
curl -O https://swift.org/builds/development/ubuntu1510/${SWIFT_PREFIX}/${SWIFT_RELEASE}.tar.gz && \
|
||||
curl -O https://swift.org/builds/swift-3.0-preview-3/ubuntu1510/${SWIFT_PREFIX}/${SWIFT_RELEASE}.tar.gz && \
|
||||
tar xvzf ${SWIFT_RELEASE}.tar.gz && \
|
||||
rm ${SWIFT_RELEASE}.tar.gz
|
||||
|
||||
# tar xvzf ${SWIFT_RELEASE}.tar.gz --directory / --strip-components 1 && \
|
||||
#RUN find /usr -type f | xargs -ifoo chmod go+r foo && \
|
||||
# find /usr -type d | xargs -ifoo chmod go+rx foo
|
||||
|
||||
#RUN find /opt/${SWIFT_RELEASE}/ -type f | xargs -ifoo chmod go+r foo && \
|
||||
# find /opt/${SWIFT_RELEASE}/ -type d | xargs -ifoo chmod go+rx foo
|
||||
|
||||
ENV PATH /opt/${SWIFT_RELEASE}/usr/bin/:$PATH
|
||||
|
||||
# TODO: better way to do this? And move up.
|
||||
|
@ -76,6 +76,7 @@ class Env {
|
||||
}
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func set(_ key: MalVal, _ val: MalVal) throws -> MalVal {
|
||||
switch key {
|
||||
case MalVal.MalSymbol(let str):
|
||||
|
@ -99,6 +99,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
ast = lst[2] // TCO
|
||||
case MalVal.MalSymbol("do"):
|
||||
let slc = lst[1..<lst.index(before: lst.endIndex)]
|
||||
try eval_ast(list(Array(slc)), env)
|
||||
try _ = eval_ast(list(Array(slc)), env)
|
||||
ast = lst[lst.index(before: lst.endIndex)] // TCO
|
||||
case MalVal.MalSymbol("if"):
|
||||
switch try EVAL(lst[1], env) {
|
||||
@ -104,6 +104,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
ast = lst[2] // TCO
|
||||
case MalVal.MalSymbol("do"):
|
||||
let slc = lst[1..<lst.index(before: lst.endIndex)]
|
||||
try eval_ast(list(Array(slc)), env)
|
||||
try _ = eval_ast(list(Array(slc)), env)
|
||||
ast = lst[lst.index(before: lst.endIndex)] // TCO
|
||||
case MalVal.MalSymbol("if"):
|
||||
switch try EVAL(lst[1], env) {
|
||||
@ -104,6 +104,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
switch a0 {
|
||||
case MalVal.MalSymbol("unquote"):
|
||||
return try! _nth(ast, 1)
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
if is_pair(a0) {
|
||||
let a00 = try! _nth(a0, 0)
|
||||
@ -31,7 +31,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
return list([MalVal.MalSymbol("concat"),
|
||||
try! _nth(a0, 1),
|
||||
quasiquote(try! rest(ast))])
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
ast = quasiquote(lst[1]) // TCO
|
||||
case MalVal.MalSymbol("do"):
|
||||
let slc = lst[1..<lst.index(before: lst.endIndex)]
|
||||
try eval_ast(list(Array(slc)), env)
|
||||
try _ = eval_ast(list(Array(slc)), env)
|
||||
ast = lst[lst.index(before: lst.endIndex)] // TCO
|
||||
case MalVal.MalSymbol("if"):
|
||||
switch try EVAL(lst[1], env) {
|
||||
@ -142,6 +142,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
switch a0 {
|
||||
case MalVal.MalSymbol("unquote"):
|
||||
return try! _nth(ast, 1)
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
if is_pair(a0) {
|
||||
let a00 = try! _nth(a0, 0)
|
||||
@ -31,7 +31,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
return list([MalVal.MalSymbol("concat"),
|
||||
try! _nth(a0, 1),
|
||||
quasiquote(try! rest(ast))])
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
|
||||
ast = try macroexpand(ast, env)
|
||||
switch ast {
|
||||
case MalVal.MalList: true
|
||||
case MalVal.MalList: break
|
||||
default: return try eval_ast(ast, env)
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
return try macroexpand(lst[1], env)
|
||||
case MalVal.MalSymbol("do"):
|
||||
let slc = lst[1..<lst.index(before: lst.endIndex)]
|
||||
try eval_ast(list(Array(slc)), env)
|
||||
try _ = eval_ast(list(Array(slc)), env)
|
||||
ast = lst[lst.index(before: lst.endIndex)] // TCO
|
||||
case MalVal.MalSymbol("if"):
|
||||
switch try EVAL(lst[1], env) {
|
||||
@ -192,6 +192,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
switch a0 {
|
||||
case MalVal.MalSymbol("unquote"):
|
||||
return try! _nth(ast, 1)
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
if is_pair(a0) {
|
||||
let a00 = try! _nth(a0, 0)
|
||||
@ -31,7 +31,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
return list([MalVal.MalSymbol("concat"),
|
||||
try! _nth(a0, 1),
|
||||
quasiquote(try! rest(ast))])
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
|
||||
ast = try macroexpand(ast, env)
|
||||
switch ast {
|
||||
case MalVal.MalList: true
|
||||
case MalVal.MalList: break
|
||||
default: return try eval_ast(ast, env)
|
||||
}
|
||||
|
||||
@ -167,16 +167,16 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
}
|
||||
return try EVAL(a22, Env(env, binds: list([a21]),
|
||||
exprs: list([err])))
|
||||
default: true // fall through
|
||||
default: break
|
||||
}
|
||||
default: true // fall through
|
||||
default: break
|
||||
}
|
||||
}
|
||||
throw exc
|
||||
}
|
||||
case MalVal.MalSymbol("do"):
|
||||
let slc = lst[1..<lst.index(before: lst.endIndex)]
|
||||
try eval_ast(list(Array(slc)), env)
|
||||
try _ = eval_ast(list(Array(slc)), env)
|
||||
ast = lst[lst.index(before: lst.endIndex)] // TCO
|
||||
case MalVal.MalSymbol("if"):
|
||||
switch try EVAL(lst[1], env) {
|
||||
@ -225,6 +225,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
switch a0 {
|
||||
case MalVal.MalSymbol("unquote"):
|
||||
return try! _nth(ast, 1)
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
if is_pair(a0) {
|
||||
let a00 = try! _nth(a0, 0)
|
||||
@ -31,7 +31,7 @@ func quasiquote(_ ast: MalVal) -> MalVal {
|
||||
return list([MalVal.MalSymbol("concat"),
|
||||
try! _nth(a0, 1),
|
||||
quasiquote(try! rest(ast))])
|
||||
default: true // fallthrough
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
|
||||
ast = try macroexpand(ast, env)
|
||||
switch ast {
|
||||
case MalVal.MalList: true
|
||||
case MalVal.MalList: break
|
||||
default: return try eval_ast(ast, env)
|
||||
}
|
||||
|
||||
@ -167,16 +167,16 @@ func EVAL(_ orig_ast: MalVal, _ orig_env: Env) throws -> MalVal {
|
||||
}
|
||||
return try EVAL(a22, Env(env, binds: list([a21]),
|
||||
exprs: list([err])))
|
||||
default: true // fall through
|
||||
default: break
|
||||
}
|
||||
default: true // fall through
|
||||
default: break
|
||||
}
|
||||
}
|
||||
throw exc
|
||||
}
|
||||
case MalVal.MalSymbol("do"):
|
||||
let slc = lst[1..<lst.index(before: lst.endIndex)]
|
||||
try eval_ast(list(Array(slc)), env)
|
||||
try _ = eval_ast(list(Array(slc)), env)
|
||||
ast = lst[lst.index(before: lst.endIndex)] // TCO
|
||||
case MalVal.MalSymbol("if"):
|
||||
switch try EVAL(lst[1], env) {
|
||||
@ -225,6 +225,7 @@ func PRINT(_ exp: MalVal) -> String {
|
||||
|
||||
|
||||
// repl
|
||||
@discardableResult
|
||||
func rep(_ str:String) throws -> String {
|
||||
return PRINT(try EVAL(try READ(str), repl_env))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user