Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/stz-arg-parser.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ defn single? (f:Flag) :

public defn parse-args (comms:Collection<Command>, default-comm:False|Command, args:Seqable<String>) -> False :
;Get sequence of arguments
val args-seq = to-seq(args)
val args-seq = to-peek-seq(args)
if default-comm is False :
throw(NoCommand()) when empty?(args-seq)

Expand Down
8 changes: 4 additions & 4 deletions compiler/stz-call-records.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public defn callc-records (a1:Tuple<ArgType>, a2:ArgType, backend:Backend) -> Ca
add(records, CallRecord(l,ShadowArg(i)))

;Track registers
val reg-counter = to-seq(0 to length(callc-regs(backend)))
val freg-counter = to-seq(0 to length(callc-fregs(backend)))
val mem-counter = to-seq(0 to false)
val reg-counter = to-peek-seq(0 to length(callc-regs(backend)))
val freg-counter = to-peek-seq(0 to length(callc-fregs(backend)))
val mem-counter = to-peek-seq(0 to false)
defn next-reg () :
val index = next(reg-counter)
val id = callc-regs(backend)[index]
Expand Down Expand Up @@ -104,7 +104,7 @@ public defn callc-records (a1:Tuple<ArgType>, a2:ArgType, backend:Backend) -> Ca
(a2:RealArg) : FRegLoc(callc-fret(backend), 0)

;Count number of args used
defn peek? (xs:Seq<Int>, default:Int) : default when empty?(xs) else peek(xs)
defn peek? (xs:PeekSeq<Int>, default:Int) : default when empty?(xs) else peek(xs)
val num-int-args = peek?(reg-counter, length(callc-regs(backend)))
val num-real-args = peek?(freg-counter, length(callc-fregs(backend)))
val num-mem-args = peek(mem-counter)
Expand Down
4 changes: 2 additions & 2 deletions compiler/stz-dyn-graph.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ defmulti yield-right<?X,?Y> (m:Merger<?X,?Y>, y:Y) -> False
defmulti yield-merged<?X,?Y> (m:Merger<?X,?Y>, x:X, y:Y) -> False

defn merge<?X,?Y> (merger:Merger<?X,?Y>, xs:Seqable<X>, ys:Seqable<Y>) :
val xs-seq = to-seq(xs)
val ys-seq = to-seq(ys)
val xs-seq = to-peek-seq(xs)
val ys-seq = to-peek-seq(ys)

let loop () :
match(empty?(xs-seq), empty?(ys-seq)) :
Expand Down
2 changes: 1 addition & 1 deletion compiler/stz-el-to-vm.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ defn true-obj (iotable:IOTable) :
;============================================================

defn type-parts (t:EType, iotable:IOTable) -> Tuple<String|ETVar> :
val parts = generate<String|ETVar> :
val parts = PeekSeq $ generate<String|ETVar> :
;Break down type into parts
defn level (t:EType) :
match(t) :
Expand Down
2 changes: 1 addition & 1 deletion compiler/stz-front-end.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ defn FrontEnd (sys:FrontEndInputs) -> FrontEnd :
throw(FrontEndErrors(errors)) when not empty?(errors)

defn sub-ipackages (objs:Seqable<IPackage|Pkg>, new-ipackages:Seqable<IPackage>) -> Tuple<IPackage|Pkg> :
val pkg-seq = to-seq(new-ipackages)
val pkg-seq = to-peek-seq(new-ipackages)
val result = to-tuple $ for obj in objs seq? :
match(obj) :
(obj:IPackage) :
Expand Down
2 changes: 1 addition & 1 deletion compiler/stz-input.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ defn ls-name-args (e:IExp) -> [IExp, List<IExp>] :
defn split-packages (e:IExp, default-imports:Tuple<IImport>) :
;Flatten sequence of expressions
defn flatten (e:IExp) :
generate<IExp> :
PeekSeq $ generate<IExp> :
let loop (e:IExp = e) :
match(e:IBegin) : do(loop, exps(e))
else : yield(e)
Expand Down
7 changes: 3 additions & 4 deletions compiler/stz-langs.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ defsyntax stz-fast-print-lang :

defn compile (info:False|FileInfo, format:String, args:List) :
;Break into parts
val parts = generate<Char|One> :
val parts = PeekSeq $ generate<Char|One> :
val n = length(format)
val args-seq = to-seq(args)
let loop (i:Int = 0) :
Expand Down Expand Up @@ -876,6 +876,5 @@ defn compile (info:False|FileInfo, format:String, args:List) :
;Compile into print statements
List $ for p in pieces seq-append :
fill-template(`(print(x)), [`x => p])





4 changes: 2 additions & 2 deletions compiler/stz-set-utils.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public defn subset-of-union? (xs:Tuple<Int>, yss:Seqable<Tuple<Int>>) -> True|Fa

public defn union (a:Seqable<Int>, b:Seqable<Int>) -> Seq<Int> :
generate<Int> :
val [sa, sb] = [to-seq(a), to-seq(b)]
val [sa, sb] = [to-peek-seq(a), to-peek-seq(b)]
while not empty?(sa) and not empty?(sb) :
val [ai, bj] = [peek(sa), peek(sb)]
if ai < bj :
Expand All @@ -64,7 +64,7 @@ public defn union (a:Seqable<Int>, b:Seqable<Int>) -> Seq<Int> :

public defn intersect (a:Seqable<Int>, b:Seqable<Int>) -> Seq<Int> :
generate<Int> :
val [sa, sb] = [to-seq(a), to-seq(b)]
val [sa, sb] = [to-peek-seq(a), to-peek-seq(b)]
while not empty?(sa) and not empty?(sb) :
val [ai, bj] = [peek(sa), peek(sb)]
if ai < bj :
Expand Down
6 changes: 3 additions & 3 deletions compiler/stz-test-framework.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ protected defn print-test-report (exit-on-fail?:True|False) :
val s = testing-state()

;Count statistics
val skip-counter = to-seq(0 to false)
val pass-counter = to-seq(0 to false)
val fail-counter = to-seq(0 to false)
val skip-counter = to-peek-seq(0 to false)
val pass-counter = to-peek-seq(0 to false)
val fail-counter = to-peek-seq(0 to false)
for r in records(s) do :
match(r) :
(r:SkippedTest) : next(skip-counter)
Expand Down
1 change: 0 additions & 1 deletion compiler/stz-vm-normalize.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -1409,4 +1409,3 @@ defn InsBuffer (function:VMFunction) :
else : i
def-table[n] = VMDef(n, t)
Local(n)

2 changes: 1 addition & 1 deletion core/arg-parser.stanza
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ defn parse-args-and-flags (flags:Tuple<Flag>, arguments:Tuple<String>) ->
name(f) => f

;Sequence of arguments
val argseq = to-seq(arguments)
val argseq = to-peek-seq(arguments)

;Returns true if the given argument is a flag.
defn flag? (arg:String) :
Expand Down
Loading