From 1e9f24c1de0de5dd723057bba765f6d4dfb57a86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 23 Sep 2023 13:03:39 +0000 Subject: [PATCH] Deploy to GitHub pages --- README.md | 446 +++++ cps.html | 480 +++++ cps.idx | 22 + cps.svg | 2152 +++++++++++++++++++++ cps/defers.html | 149 ++ cps/defers.idx | 3 + cps/environment.html | 643 +++++++ cps/environment.idx | 36 + cps/exprs.html | 151 ++ cps/exprs.idx | 3 + cps/help.html | 203 ++ cps/help.idx | 8 + cps/hooks.html | 293 +++ cps/hooks.idx | 14 + cps/normalizedast.html | 4107 ++++++++++++++++++++++++++++++++++++++++ cps/normalizedast.idx | 299 +++ cps/returns.html | 263 +++ cps/returns.idx | 12 + cps/rewrites.html | 548 ++++++ cps/rewrites.idx | 37 + cps/spec.html | 1572 +++++++++++++++ cps/spec.idx | 105 + cps/transform.html | 206 ++ cps/transform.idx | 7 + demo.svg | 47 + dochack.js | 1607 ++++++++++++++++ index.html | 1738 +++++++++++++++++ nimdoc.out.css | 1033 ++++++++++ taste.svg | 47 + techo.svg | 47 + theindex.html | 1738 +++++++++++++++++ tzevv.svg | 47 + 32 files changed, 18063 insertions(+) create mode 100644 README.md create mode 100644 cps.html create mode 100644 cps.idx create mode 100644 cps.svg create mode 100644 cps/defers.html create mode 100644 cps/defers.idx create mode 100644 cps/environment.html create mode 100644 cps/environment.idx create mode 100644 cps/exprs.html create mode 100644 cps/exprs.idx create mode 100644 cps/help.html create mode 100644 cps/help.idx create mode 100644 cps/hooks.html create mode 100644 cps/hooks.idx create mode 100644 cps/normalizedast.html create mode 100644 cps/normalizedast.idx create mode 100644 cps/returns.html create mode 100644 cps/returns.idx create mode 100644 cps/rewrites.html create mode 100644 cps/rewrites.idx create mode 100644 cps/spec.html create mode 100644 cps/spec.idx create mode 100644 cps/transform.html create mode 100644 cps/transform.idx create mode 100644 demo.svg create mode 100644 dochack.js create mode 100644 index.html create mode 100644 nimdoc.out.css create mode 100644 taste.svg create mode 100644 techo.svg create mode 100644 theindex.html create mode 100644 tzevv.svg diff --git a/README.md b/README.md new file mode 100644 index 00000000..a3eff480 --- /dev/null +++ b/README.md @@ -0,0 +1,446 @@ +# CPS - also known as Continuation-Passing Style - for Nim. + +People watching the Nim community have likely heard the term "CPS" over the last +few months. It seems there is some confusion about CPS. Specifically, what CPS +_is_, what it _is not_, what it can _do_ and what it can _not do_. + +This short writeup attempts to answer the above questions and describes a few +technicalities involved with CPS, and how this could fit in the Nim ecosystem. + +NB: This document uses the term **CPS** for the programming style using +continuations, and **Nim-CPS** when referring to the particular implementation +that is currently under development. + +## TL;DR -- minute summary + +*Nim-CPS* is a macro that transforms procedures. This transformation +takes a single function definition as input via a pragma, and produces +the following outputs: + +- a **continuation** type, typically an `object`, which contains a function + pointer and any local variables from the original function + +- a new **continuation leg** function for each list of statements between + control-flow changes in the original procedure; these leg functions + are modified to use the **continuation** fields in lieu of local + variables, and at exit of each leg, the function pointer in the + **continuation** is updated to point to the next leg in the control-flow + path + +- a new convenience function having the same signature as the original + function, which instantiates a new instance of the **continuation** type + +The stack is not needed after this transformation, which allows for some +interesting possibilities: + +- Transformed functions _may_ now be interrupted, either cooperatively or + pre-emptively, at each continuation leg. + +- Continuation legs _may_ be called in arbitrary order, or not at all. + +- Some or all of the continuation legs _may_ be run in different threads. + +Note that _may_ was often used; this is where new libraries may provide +additional functionality: + +- Interrupting and resuming function execution, while running another + function, is the basis of `yield` (coroutines! iterators! generators!), + or one can wait for I/O to become available (async I/O!). + +- Varying the invocation order of continuation legs allows you to build + custom control-flow primitives (goto! exceptions!) + _without needing support from the language_. + +- Moving continuation legs that are known to block (calculations, + DNS lookups, etc.) to another thread while keeping the main program + responsive (background processing!). + +- [TODO talk about Nim's threading support] + +*Nim-CPS is not*: + +- an alternative implementation of `async`. As a matter of fact, Nim-CPS does + not know anything about sockets, I/O, system calls, etc. That said, it is + perfectly possible to implement something like `async` using CPS as a building + block + +- [TODO What more is Nim-CPS not] + +# What Is This and Why Should I Care? + +![CPS](/docs/cps.svg) + +## Control-flow on the Stack + +Computer programs written in *procedural* programming languages are typically +composed of functions calling other functions, making up a kind of tree-shaped +form. + +As an example of this control-flow, consider the following Nim program: + +```nim +proc func3() = + echo "three" + +proc func2() = + echo "two" + func3() + +proc func1() = + echo "one" + +proc main() = + echo "entry" + func1() + func2() + echo "exit" + +main() +``` + +This is a rendering of that program's control-flow to show the tree structure: + +``` + ----[main..] - - [..main..] - - - - - - - - - - [..main]---> end + | ^ | ^ + v | v | + [func1] - - - [func2..] - - [..func2] + | ^ + v | + [func3] +``` + +As control-flow is introduced, the tree -- also known as a **stack** -- grows +and shrinks; it must do so in order to keep track of variables the programmer +defined and the functions the programmer called so that it can *resume* +control-flow when those functions complete. + +## Stack Growth + +When a function *calls* another function, it will store the *return address* on +the stack; when the *called* function is done, the program will continue the +*calling* function from that return address. + +This way of programming is structured and easy to reason about, but the +consequence is that there is only "one way" your program can flow: it goes into +functions, and only leaves them when they return. When your function calls +another function, the stack grows, consuming a limited memory resource that is +often inaccessible and of little use to the new function context. + +If your program decides that it doesn't need some memory it consumed on the +stack in a parent function context, there's no easy way to recover that +resource. You might imagine that this is particularly problematic with +recursive functions, and you have perhaps run into a *stack overflow* error in +these cases. + +## Enter CPS + +A different approach to control-flow is _**Continuation-Passing Style**_, or +**CPS**. CPS sounds a bit abstract if you're not knee-deep in computer science, +but the concept is actually very simple and as the name implies, it is merely a +*style* of programming control-flow which you can trivially adopt in almost any +program. + +This document will demonstrate both how to write or modify programs using +CPS, and why you might want to do so in your own programs. We use Nim in the +examples, but CPS is applicable to almost any language with functions. + +## A little history of CPS + +First, CPS is nothing new; in the Lisp world people have been doing CPS since +the '70s, and in some languages (mainly those of the functional-programming +style) CPS is a common programming paradigm. + +## Simplifying Control-flow with CPS + +Using CPS, a completed function will not return to its caller using the return +address on the stack; instead it will directly call another function and +execution will continue from there. + +Let's rewrite our example in CPS. + +```nim +proc func3() = + echo "three" + +proc func2() = + echo "two" + func3() + +proc func1() = + echo "one" + func2() + +proc main() = + echo "entry" + func1() + echo "exit" + +main() +``` + +Now let's see what our tree looks like. + +``` + ----[main] [main] ---> end + | ^ + v | + [func1] [func1] + | ^ + v | + [func2] [func2] + | ^ + v | + [func3] +``` + +## There's Just One Problem + +This is silly! After leaving each of these functions, `main`, `func1`, `func2`, +and even `func3`, we never return to the caller's function context, yet we +still pay the penalty of having visited in the first place. + +However, when you think about it, the program is already simpler to follow and +we've managed to constrain this problem of optimizing or eliminating stack +growth to a single scenario: a function call at the tail of another function. + +## Tail-Call Optimization + +Indeed, `gcc` and `clang` may be able to recognize that control-flow need +never revisit the calling function and thus unwind the stack before making +the function call at the tail. This is appropriately-termed **Tail-Call +Optimization** or **Tail-Call Elimination**. + +Unfortunately, this optimization is not guaranteed by Nim, and as a result, we +need to address stack growth directly in Nim. + +## Enter the Trampoline + +What we really want is to run the first function, then run the next function, +then run the next function, and so on until there are no more functions to run. + +To achieve this, we have each function in the chain tell the program where to +go next using a simple loop that executes each function until the chain is +terminated. + +```nim +proc done(): auto = + return done + +proc func3(): auto = + echo "three" + return done + +proc func2(): auto = + echo "two" + return func3 + +proc func1(): auto = + echo "one" + return func2 + +proc main() = + echo "entry" + var next = func1 + while next != done: + next = next() + echo "exit" + +main() +``` + +Now our stack tree looks like this: + +``` + ----[main] [main] [main] [main] ---> end + | ^ | ^ | ^ + v | v | v | + [func1] [func2] [func3] +``` + +Perfect! We performed the same control-flow with no inefficient stack growth. + +## You Call That 'Simple'? + +Hang in there; it's going to get worse before it gets better. 😁 + +Let's modify our original program to add some more complexity. + +```nim +import times + +proc spin() = + if getTime().toUnix mod 2 == 0: + echo "come back later" + spin() + else: + echo "okay, it's time" + +proc main() = + echo "entry" + spin() + echo "exit" + +main() +``` + +Now the program prints `come back later` until the epoch time is odd, at which +point it prints `okay, it's time` and then completes, printing `exit`. This is +a very elegant control-flow design, but there's a bug in this program because +sometimes we spin so much that we exhaust the stack just by bookkeeping the +entry and exit of the `spin` procedure. + +Let's see how this is solved in CPS. + +```nim +import times + +proc okay(): auto = + echo "okay, it's time" + okay + +proc spin(): auto = + if getTime().toUnix mod 2 == 0: + echo "come back later" + spin + else: + okay + +proc main() = + echo "entry" + var next = spin + while next != okay: + next = next() + echo "exit" + +main() +``` + +Actually, that wasn't so bad. In fact, it's similar in size to the original +version, but the version using CPS doesn't suffer the stack-overflow bug. + +Hopefully, you can start to see some advantages to this method of structuring +control-flow, but perhaps you've also noticed a new issue, which brings us +to... + +## Local Variables + +Remember when I said things would get worse before they get better? This is +that. 😈 But trust me, if you can get through this little section, you're +home free. + +First, let's introduce some local state in our program. + +```nim +import times, strutils + +proc spin() = + var now = getTime() + if now.toUnix mod 2 == 0: + echo "come back later" + spin() + else: + echo "okay, it's $#" % [$now] + +proc main() = + echo "entry" + spin() + echo "exit" + +main() +``` + +Our CPS version of the _previous_ program does the `okay...` echo in a separate +function, but that's going to be a problem here because that function doesn't +have access to the `now` variable. We cannot supply it as an argument to the +`okay` procedure because changing the signature of the procedure from that of +`spin` will cause it to be unusable in our trampoline. + +We could change both signatures thusly: +```nim +proc spin(now: Time) +proc okay(now: Time) +``` +But this will clearly be burdensome as the complexity of our program grows. + +A more general solution is to share variables of the functions throughout the +CPS call chain; each procedure can receive the same object as input and mutate +that _environment_ before directing the trampoline to the next function in the +chain. + +We begin our `OddTimer` object definition with the `next` function target for +the trampoline, and then we add the `now` variable to the environment. + +```nim +import times, strutils + +type OddTimer = ref object + next: proc (c: OddTimer): OddTimer + now: Time + +proc okay(c: OddTimer): OddTimer = + echo "okay, it's $#" % [$c.now] + return nil + +proc spin(c: OddTimer): OddTimer = + c.now = getTime() + if c.now.toUnix mod 2 == 0: + echo "come back later" + else: + c.next = okay + return c + +proc main() = + echo "entry" + var c = OddTimer(next: spin) + while c != nil: + c = c.next(c) + echo "exit" + +main() +``` + +You probably noticed that we're using a `ref object` to hold these values; this +neatly moves the allocations with a longer lifetime from the stack to the heap. + +## But You Said It Would Be Simple! + +Use of CPS in procedural code is rare for the reasons you've seen in these +examples: it may be easier to reason about the functions in your program +individually, but harder to digest a greater perspective that shows the more +complex control-flow path. + +What you _really_ want is to write your program so it is easiest to read, and +then pass it off to an accountant who will rewrite it for maximum efficiency, +using CPS. + +This is where we segue into Nim's metaprogramming contribution... + +# Nim-CPS + +## A little history of Nim-CPS + +Somewhere in the summer of '20, a few people started to think about what an +implementation of CPS could bring to Nim, and what this would look like. First +inspiration for in implementation was suggested by @Araq, who pointed to a +paper describing a rudimentary CPS implementation for the C language. + +https://github.com/nim-works/cps/blob/master/papers/1011.4558.pdf + +Using the algorithms in this paper as inspiration, a first implementation of +Nim-CPS was built using Nim's powerful metaprogramming. This allowed CPS to be +available as a library only, without needing support from the compiler or the +language. + +[Nim-CPS repository on GitHub](https://www.github.com/nim-works/cps) + +## What Nim-CPS can do for you, today + +[The repository links to a series of examples @Zevv prepared to showcase CPS](https://github.com/nim-works/cps#examples) + +[The repository also includes a walkthrough that shows the implementation of `GOTO` +from scratch using CPS.](https://github.com/disruptek/cps#application) + +## The future of Nim-CPS + +_Your contribution here!_ diff --git a/cps.html b/cps.html new file mode 100644 index 00000000..57d4312d --- /dev/null +++ b/cps.html @@ -0,0 +1,480 @@ + + + + + + + +cps + + + + + + + + + + + + +
+
+

cps

+
+ +
+ Source   +Edit   + +
+ +

+ +
+

Procs

+
+
+
+
proc alloc[T: Continuation](U: typedesc[T]; E: typedesc): E:type {.used, inline.}
+
+ + Reimplement this symbol to customize continuation allocation; U is the type supplied by the user as the cps macro argument, while E is the type of the environment composed for the specific continuation. + Source   +Edit   + +
+
+ +
+
+
+
proc dealloc[T: Continuation](c: sink T; E: typedesc[T]): E:type {.used, inline.}
+
+ + Reimplement this symbol to customize continuation deallocation; c is the continuation to be deallocated, while E is the type of its environment. This procedure should generally return nil, as its result may be assigned to another continuation reference. + Source   +Edit   + +
+
+ +
+
+
+
proc disarm[T: Continuation](c: T) {.used, inline.}
+
+ + Reimplement this symbol to customize preparation of a continuation for deallocation. + Source   +Edit   + +
+
+ +
+
+
+
proc state(c: Continuation): State {.inline, ...raises: [], tags: [], forbids: [].}
+
+ + Get the current state of a continuation + Source   +Edit   + +
+
+ +
+
+
+
proc tail[T: Continuation](parent: Continuation; child: T): T {.used, inline.}
+
+ +

Reimplement this symbol to configure a continuation for use when it has been instantiated from inside another continuation; currently, this means assigning the parent to the child's mom field. The return value specifies the child continuation.

+

NOTE: If you implement this as a template, be careful that you assign the child to a variable before manipulating its fields, as it may be an expression...

+ + Source   +Edit   + +
+
+ +
+
+
+
proc traceDeque(hook: Hook; c, n: NimNode; fun: string; info: LineInfo;
+                body: NimNode): NimNode {.used, ...raises: [], tags: [],
+    forbids: [].}
+
+ + This is the default tracing implementation which can be reused when implementing your own trace macros. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Macros

+
+
+
+
macro `()`[C; R; P](callback: Callback[C, R, P]; arguments: varargs[typed]): R
+
+ + Allows for natural use of call syntax to invoke a callback and recover its result in a single statement, inside a continuation. + Source   +Edit   + +
+
+ +
+
+
+
macro cps(tipe: typed; n: untyped): untyped
+
+ + When applied to a procedure, rewrites the procedure into a continuation form. When applied to a procedure type definition, rewrites the type into a callback form. + Source   +Edit   + +
+
+ +
+
+
+
macro stack[T: Continuation](frame: TraceFrame; target: T): T {.used.}
+
+ + Reimplement this symbol to alter the recording of "stack" frames. The return value evaluates to the continuation. + Source   +Edit   + +
+
+ +
+
+
+
macro trace(hook: static[Hook]; source, target: typed; fun: string;
+            info: LineInfo; body: typed): untyped {.used.}
+
+ + Reimplement this symbol to introduce control-flow tracing of each hook and entry to each continuation leg. The fun argument holds a simple stringification of the target that emitted the trace, while target holds the symbol itself. + Source   +Edit   + +
+
+ +
+
+
+
macro whelp(call: typed): untyped
+
+ +

Instantiate the given continuation call but do not begin running it; instead, return the continuation as a value.

+

If you pass whelp a continuation procedure symbol instead, the result is a Callback which you can use to create many individual continuations or recover the result of an extant continuation.

+ + Source   +Edit   + +
+
+
+
macro whelp(parent: Continuation; call: typed): untyped
+
+ + As in whelp(call(...)), but also links the new continuation to the supplied parent for the purposes of exception handling and similar. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template boot[T: Continuation](c: T): T {.used.}
+
+ + Reimplement this symbol to refine a continuation after it has been allocated but before it is first run. The return value specifies the continuation. + Source   +Edit   + +
+
+ +
+
+
+
template coop[T: Continuation](c: T): T {.used.}
+
+ + Reimplement this symbol as a .cpsMagic. to introduce a cooperative yield at appropriate continuation exit points. The return value specifies the continuation. + Source   +Edit   + +
+
+ +
+
+
+
template dismissed(c: Continuation): bool
+
+ + true if the continuation was dimissed. + Source   +Edit   + +
+
+ +
+
+
+
template finished(c: Continuation): bool
+
+ + true if the continuation is finished. + Source   +Edit   + +
+
+ +
+
+
+
template head[T: Continuation](first: T): T {.used.}
+
+ + Reimplement this symbol to configure a continuation for use when there is no parent continuation available. The return value specifies the continuation. + Source   +Edit   + +
+
+ +
+
+
+
template recover(c: Continuation): untyped {.used.}
+
+ + Returns the result, i.e. the return value, of a continuation. + Source   +Edit   + +
+
+ +
+
+
+
template running(c: Continuation): bool
+
+ + true if the continuation is running. + Source   +Edit   + +
+
+ +
+
+
+
template whelpIt(input: typed; body: untyped): untyped
+
+ + Instantiate the given continuation call and inject it in the body. + Source   +Edit   + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + diff --git a/cps.idx b/cps.idx new file mode 100644 index 00000000..ae82799a --- /dev/null +++ b/cps.idx @@ -0,0 +1,22 @@ +nimTitle cps cps.html module cps 0 +nim state cps.html#state,Continuation proc state(c: Continuation): State 31 +nim running cps.html#running.t,Continuation template running(c: Continuation): bool 42 +nim finished cps.html#finished.t,Continuation template finished(c: Continuation): bool 46 +nim dismissed cps.html#dismissed.t,Continuation template dismissed(c: Continuation): bool 50 +nim cps cps.html#cps.m,typed,untyped macro cps(tipe: typed; n: untyped): untyped 79 +nim whelpIt cps.html#whelpIt.t,typed,untyped template whelpIt(input: typed; body: untyped): untyped 111 +nim whelp cps.html#whelp.m,typed macro whelp(call: typed): untyped 136 +nim whelp cps.html#whelp.m,Continuation,typed macro whelp(parent: Continuation; call: typed): untyped 154 +nim head cps.html#head.t,T template head[T: Continuation](first: T): T 162 +nim tail cps.html#tail,Continuation,T proc tail[T: Continuation](parent: Continuation; child: T): T 168 +nim coop cps.html#coop.t,T template coop[T: Continuation](c: T): T 180 +nim boot cps.html#boot.t,T template boot[T: Continuation](c: T): T 186 +nim traceDeque cps.html#traceDeque,Hook,NimNode,NimNode,string,LineInfo,NimNode proc traceDeque(hook: Hook; c, n: NimNode; fun: string; info: LineInfo; body: NimNode): NimNode 207 +nim stack cps.html#stack.m,TraceFrame,T macro stack[T: Continuation](frame: TraceFrame; target: T): T 244 +nim trace cps.html#trace.m,static[Hook],typed,typed,string,LineInfo,typed macro trace(hook: static[Hook]; source, target: typed; fun: string; info: LineInfo;\n body: typed): untyped 257 +nim disarm cps.html#disarm,T proc disarm[T: Continuation](c: T) 293 +nim alloc cps.html#alloc,typedesc[T],typedesc proc alloc[T: Continuation](U: typedesc[T]; E: typedesc): E:type 301 +nim dealloc cps.html#dealloc,sinkT,typedesc[T] proc dealloc[T: Continuation](c: sink T; E: typedesc[T]): E:type 308 +nim recover cps.html#recover.t,Continuation template recover(c: Continuation): untyped 315 +nim `()` cps.html#().m,Callback[C,R,P],varargs[typed] macro `()`[C; R; P](callback: Callback[C, R, P]; arguments: varargs[typed]): R 321 +nimgrp whelp cps.html#whelp-macros-all macro 136 diff --git a/cps.svg b/cps.svg new file mode 100644 index 00000000..3b45aaff --- /dev/null +++ b/cps.svg @@ -0,0 +1,2152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + What is CPS? + CPS is short for "Continuation-Passing Style". It is a different way of doing control flow in computer programs. + +CPS can be used to implement all kinds of advanced program flow structures without requiring support from the language - think iterators, coroutines, exception handling, async schedulers, etc. + + + + Code transformations + Writing code directly in CPS style is hard, but this is where Nim-CPS comes in. It uses the power of Nim macros to transform regular code into CPS. This is done in a few steps: + +- Lift locals from the stack to the environment +- Split the proc at control flow boundaries +- Rewrite the split parts into CPS style functions + + + + + + proc count(n: int) = echo "start" var i = 0 while i < n: jield() inc i echo "end" + + type Cont = object fn: proc(c: Cont): Cont n: int i: int + + + + + + + + 1: Lift locals + The first step in the transformation is moving all the function parameters and local variables into an object called the continuation environment + + + proc count(c: Cont) = echo "start" c.i = 0 while c.i < c.n: jield() inc c.i echo "end" + + The parameters and local variables of the proc are rewritten to use the variables from the environment + + This transformation effectively eliminates the stack - what used to be on the stack is now stored in the environment + + + + + + + + proc count(c: Cont) = echo "start c.i = 0 while c.i < c.n: jield() inc c.i echo "end" + + 2: Split control flow + The code is analyzed and split at control flow boundaries + + + proc count(c: Cont) = echo "start" c.i = 0 while c.i < c.n: jield() inc c.i echo "end" + + + + + + The transformed code has not become any simpler then the original, so what is the point of this all? + +The answer lies in the power that comes with this transform: at any time during execution of function on the trampoline, the full state of the proc is captured in the continuation object. This means that the caller can at any time defer the proc by storing the continuation, and do other work in the mean time - like running other continuations, waiting for I/O on network sockets or waiting for timers to expire.. + +With this building block it is possible to build powerful constructs like coroutines, iterators, schedulers for asynchronous I/O,. + +It is also possible to run continuations in a different order; this allows you to build custom flow control in Nim, without requiring assistance from the language; constructs like goto, exception handling, defer or finally can all be expressed in terms of CPS. + + + + + + + + + + + + + + + proc count(n: int): Cont = return Cont(fn: count, n: n) + proc count(c: Cont): Cont = echo "start" c.i = 0 c.fn = whileLoop return c + proc whileLoop(c: Cont): Cont = if c.i < c.n: c.fn = afterCall return jield(c) else: c.fn = done return c + proc afterCall(c: Cont): Cont = inc c.i c.fn = whileLoop return c + proc done(c: Cont): Cont = echo "end" return nil + + + + + + + 3: CPS transformation + This transformation is the heart of CPS: The split chunks of code are moved into separate procs. Each of these procs takes and returns the continuation type. + + + + + + proc count(n: int) = echo "start var i = 0 while i < n: jield() inc i echo "end" + The original control flow structures like if, while, return, etc are rewritten to their simplest form, and only do one thing: they return the continuation with the function pointer now pointing to the next block that should be called - this is the continuation. + + + The first function is special: it is called the bootstrap and is used to initialize the continuation to allow the code to start running. + + The jield() function in this example +is special, TODO explain cpsMagic. + + + Running the code + Now the code has been transformed into CPS style, the next thing would be to run it. This is done using a simple construct called a trampoline. The trampoline takes the continuation and iteratively calls its current function pointer fn(c: Cont): Cont: + + + + + + + var c = count(2)while c.fn != nil: c = c.fn(c) + + count() + + + + + whileLoop() + + + + + afterCall() + + + + + whileLoop() + + + + + afterCall() + + + + + done() + + + + + + + + + + The result of the function execution is exactly the same as in the original, untransformed code. + + + + + + + What is the use of all this? + + CPS + + + diff --git a/cps/defers.html b/cps/defers.html new file mode 100644 index 00000000..eedd3233 --- /dev/null +++ b/cps/defers.html @@ -0,0 +1,149 @@ + + + + + + + +cps/defers + + + + + + + + + + + + +
+
+

cps/defers

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+ +
+

Procs

+
+
+
+
proc rewriteDefer(n: NormNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + Rewrite the AST of n so that all defer nodes are transformed into try-finally + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template isNotNil(x: untyped): bool
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/defers.idx b/cps/defers.idx new file mode 100644 index 00000000..1439c951 --- /dev/null +++ b/cps/defers.idx @@ -0,0 +1,3 @@ +nimTitle defers cps/defers.html module cps/defers 0 +nim isNotNil cps/defers.html#isNotNil.t,untyped template isNotNil(x: untyped): bool 4 +nim rewriteDefer cps/defers.html#rewriteDefer,NormNode proc rewriteDefer(n: NormNode): NormNode 64 diff --git a/cps/environment.html b/cps/environment.html new file mode 100644 index 00000000..febf11e6 --- /dev/null +++ b/cps/environment.html @@ -0,0 +1,643 @@ + + + + + + + +cps/environment + + + + + + + + + + + + +
+
+

cps/environment

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

The Env(ironment) tracks continuation types and the variables of which they are comprised.

+ +
+

Types

+
+
+
CachePair = tuple[key: Name, val: VarLetIdentDef]
+
+ + + Source   +Edit   + +
+
+
+
Env = ref object
+  when cpsReparent:
+    
+  
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc createBootstrap(env: Env; n: ProcDef; goto: NormNode): ProcDef {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + the bootstrap needs to create a continuation and trampoline it + Source   +Edit   + +
+
+ +
+
+
+
proc createCallbackShim(env: Env; whelp: ProcDef): ProcDef {.
+    ...raises: [ValueError], tags: [], forbids: [].}
+
+ + this is a version of whelp that returns the base continuation type + Source   +Edit   + +
+
+ +
+
+
+
proc createContinuation(e: Env; name: Name; goto: NimNode): NimNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + allocate a continuation as name and maybe aim it at the leg goto + Source   +Edit   + +
+
+ +
+
+
+
proc createRecover(env: Env; exported = false): NimNode {....raises: [ValueError],
+    tags: [], forbids: [].}
+
+ +

define procedures for retrieving the result of a continuation

+

exported determines whether these procedures will be exported

+ + Source   +Edit   + +
+
+ +
+
+
+
proc createWhelp(env: Env; n: ProcDef; goto: NormNode): ProcDef {.
+    ...raises: [ValueError, Exception], tags: [RootEffect], forbids: [].}
+
+ + the whelp needs to create a continuation + Source   +Edit   + +
+
+ +
+
+
+
proc first(e: Env): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc firstDef(e: Env): IdentDef {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc genException(e: var Env): NimNode {....raises: [ValueError, Exception],
+    tags: [RootEffect], forbids: [].}
+
+ +

generates a new symbol of type ref Exception, then put it in the env.

+

returns the access to the exception symbol from the env.

+ + Source   +Edit   + +
+
+ +
+
+
+
proc getResult(e: Env): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + retrieve a continuation's result value from the env + Source   +Edit   + +
+
+ +
+
+
+
proc identity(e: Env): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc identity(e: var Env): Name {....raises: [], tags: [], forbids: [].}
+
+ + identifier of our continuation type + Source   +Edit   + +
+
+ +
+
+
+
proc inherits(e: Env): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func isDirty(e: Env): bool {....raises: [], tags: [], forbids: [].}
+
+ + the type hasn't been written since an add occurred + Source   +Edit   + +
+
+ +
+
+
+
proc isEmpty(e: Env): bool {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc len(e: Env): int {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc localSection(e: var Env; n: IdentDef; into: NimNode = nil) {.
+    ...raises: [ValueError, Exception], tags: [RootEffect], forbids: [].}
+
+ + consume nnkIdentDefs and populate into with assignments, even if into is nil, the n will be cached locally + Source   +Edit   + +
+
+
+
proc localSection(e: var Env; n: RoutineParam; into: NimNode = nil) {.borrow,
+    ...raises: [ValueError, Exception], tags: [RootEffect], forbids: [].}
+
+ + consume proc definition params and yield name, node pairs representing assignments to local scope. + Source   +Edit   + +
+
+
+
proc localSection(e: var Env; n: VarLet; into: NimNode = nil) {.
+    ...raises: [ValueError, Exception], tags: [RootEffect], forbids: [].}
+
+ + consume a var|let section and yield name, node pairs representing assignments to local scope + Source   +Edit   + +
+
+ +
+
+
+
proc makeType(e: Env): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc maybeConvertToRoot(e: Env; locals: NormNode): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + add an Obj(foo: bar).Other conversion if necessary + Source   +Edit   + +
+
+ +
+
+
+
proc newEnv(c: Name; store: var NormNode; via: Name; rs: NormNode;
+            procedure: string): Env {....raises: [ValueError, Exception],
+                                      tags: [RootEffect], forbids: [].}
+
+ + the initial version of the environment; c names the first parameter of continuations, store is where we add types and procedures, via is the type from which we inherit, rs is the return type (if not nnkEmpty) of the continuation. + Source   +Edit   + +
+
+
+
proc newEnv(parent: Env; copy = off): Env {....raises: [ValueError, Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + this is called as part of the recursion in the front-end, or on-demand in the back-end (with copy = on) + Source   +Edit   + +
+
+
+
proc newEnv(store: var NormNode; via: Name; rs: NormNode; procedure: string): Env {.
+    ...raises: [ValueError, Exception], tags: [RootEffect], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc procedure(e: Env): string {....raises: [], tags: [], forbids: [].}
+
+ + the name of the procedure undergoing transformation to cps + Source   +Edit   + +
+
+ +
+
+
+
proc rewriteResult(e: Env; n: NormNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + replaces result symbols with the env's result; this should be safe to run on sem'd ast (for obvious reasons) + Source   +Edit   + +
+
+ +
+
+
+
proc rewriteReturn(e: var Env; n: NormNode): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + Rewrite a return statement to use our result field. + Source   +Edit   + +
+
+ +
+
+
+
proc rewriteSymbolsIntoEnvDotField(e: var Env; n: NormNode): NormNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + swap symbols for those in the continuation + Source   +Edit   + +
+
+ +
+
+
+
proc rewriteVoodoo(env: Env; n: NormNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + Rewrite non-yielding cpsCall calls by inserting the continuation as the first argument + Source   +Edit   + +
+
+ +
+
+
+
proc root(e: Env): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc storeType(e: Env; force = off): Env {....raises: [ValueError, Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + turn an env into a complete typedef in a type section + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/environment.idx b/cps/environment.idx new file mode 100644 index 00000000..951a0a69 --- /dev/null +++ b/cps/environment.idx @@ -0,0 +1,36 @@ +nimTitle environment cps/environment.html module cps/environment 0 +nim Env cps/environment.html#Env type Env 21 +nim CachePair cps/environment.html#CachePair tuple CachePair 37 +nim procedure cps/environment.html#procedure,Env proc procedure(e: Env): string 41 +nim len cps/environment.html#len,Env proc len(e: Env): int 48 +nim isEmpty cps/environment.html#isEmpty,Env proc isEmpty(e: Env): bool 50 +nim inherits cps/environment.html#inherits,Env proc inherits(e: Env): Name 52 +nim identity cps/environment.html#identity,Env proc identity(e: Env): Name 58 +nim isDirty cps/environment.html#isDirty,Env proc isDirty(e: Env): bool 70 +nim root cps/environment.html#root,Env proc root(e: Env): Name 74 +nim maybeConvertToRoot cps/environment.html#maybeConvertToRoot,Env,NormNode proc maybeConvertToRoot(e: Env; locals: NormNode): NormNode 86 +nim makeType cps/environment.html#makeType,Env proc makeType(e: Env): NimNode 165 +nim first cps/environment.html#first,Env proc first(e: Env): Name 169 +nim firstDef cps/environment.html#firstDef,Env proc firstDef(e: Env): IdentDef 171 +nim getResult cps/environment.html#getResult,Env proc getResult(e: Env): NormNode 175 +nim rewriteResult cps/environment.html#rewriteResult,Env,NormNode proc rewriteResult(e: Env; n: NormNode): NormNode 179 +nim newEnv cps/environment.html#newEnv,Env proc newEnv(parent: Env; copy = off): Env 193 +nim storeType cps/environment.html#storeType,Env proc storeType(e: Env; force = off): Env 211 +nim newEnv cps/environment.html#newEnv,Name,NormNode,Name,NormNode,string proc newEnv(c: Name; store: var NormNode; via: Name; rs: NormNode; procedure: string): Env 258 +nim newEnv cps/environment.html#newEnv,NormNode,Name,NormNode,string proc newEnv(store: var NormNode; via: Name; rs: NormNode; procedure: string): Env 273 +nim identity cps/environment.html#identity,Env_2 proc identity(e: var Env): Name 277 +nim localSection cps/environment.html#localSection,Env,VarLet,NimNode proc localSection(e: var Env; n: VarLet; into: NimNode = nil) 329 +nim localSection cps/environment.html#localSection,Env,IdentDef,NimNode proc localSection(e: var Env; n: IdentDef; into: NimNode = nil) 357 +nim localSection cps/environment.html#localSection,Env,RoutineParam,NimNode proc localSection(e: var Env; n: RoutineParam; into: NimNode = nil) 364 +nim rewriteReturn cps/environment.html#rewriteReturn,Env,NormNode proc rewriteReturn(e: var Env; n: NormNode): NormNode 368 +nim rewriteSymbolsIntoEnvDotField cps/environment.html#rewriteSymbolsIntoEnvDotField,Env,NormNode proc rewriteSymbolsIntoEnvDotField(e: var Env; n: NormNode): NormNode 392 +nim createContinuation cps/environment.html#createContinuation,Env,Name,NimNode proc createContinuation(e: Env; name: Name; goto: NimNode): NimNode 405 +nim genException cps/environment.html#genException,Env proc genException(e: var Env): NimNode 423 +nim createRecover cps/environment.html#createRecover,Env proc createRecover(env: Env; exported = false): NimNode 432 +nim createWhelp cps/environment.html#createWhelp,Env,ProcDef,NormNode proc createWhelp(env: Env; n: ProcDef; goto: NormNode): ProcDef 501 +nim createCallbackShim cps/environment.html#createCallbackShim,Env,ProcDef proc createCallbackShim(env: Env; whelp: ProcDef): ProcDef 527 +nim createBootstrap cps/environment.html#createBootstrap,Env,ProcDef,NormNode proc createBootstrap(env: Env; n: ProcDef; goto: NormNode): ProcDef 539 +nim rewriteVoodoo cps/environment.html#rewriteVoodoo,Env,NormNode proc rewriteVoodoo(env: Env; n: NormNode): NormNode 588 +nimgrp identity cps/environment.html#identity-procs-all proc 58 +nimgrp localsection cps/environment.html#localSection-procs-all proc 329 +nimgrp newenv cps/environment.html#newEnv-procs-all proc 193 diff --git a/cps/exprs.html b/cps/exprs.html new file mode 100644 index 00000000..f54d1bce --- /dev/null +++ b/cps/exprs.html @@ -0,0 +1,151 @@ + + + + + + + +cps/exprs + + + + + + + + + + + + +
+
+

cps/exprs

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+ +
+

Procs

+
+
+
+
proc assignTo(location, n: NormNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ +

Rewrite the expression n into a statement assigning to location.

+

Returns a copy of n if n is not an expression.

+ + Source   +Edit   + +
+
+ +
+ +
+
+
+

Macros

+
+
+
+
macro cpsFlattenExpr(n: typed): untyped
+
+ + Flatten any CPS expression in procedure n so that control flow involving them is linear. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/exprs.idx b/cps/exprs.idx new file mode 100644 index 00000000..2ef1bc2f --- /dev/null +++ b/cps/exprs.idx @@ -0,0 +1,3 @@ +nimTitle exprs cps/exprs.html module cps/exprs 0 +nim assignTo cps/exprs.html#assignTo,NormNode,NormNode proc assignTo(location, n: NormNode): NormNode 169 +nim cpsFlattenExpr cps/exprs.html#cpsFlattenExpr.m,typed macro cpsFlattenExpr(n: typed): untyped 780 diff --git a/cps/help.html b/cps/help.html new file mode 100644 index 00000000..4459f6cb --- /dev/null +++ b/cps/help.html @@ -0,0 +1,203 @@ + + + + + + + +cps/help + + + + + + + + + + + + +
+
+

cps/help

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+
+

Consts

+
+
+
comments = false
+
+ + embed comments within the transformation + Source   +Edit   + +
+
+
+
cpsDebug {.strdefine.} = ""
+
+ + produce gratuitous output + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc doc(n: NimNode; s: string) {....raises: [], tags: [], forbids: [].}
+
+ + add a doc statement to the ast for debugging + Source   +Edit   + +
+
+
+
func doc(s: string): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + generate a doc statement for debugging + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template debug(ignore: varargs[untyped])
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
template lineAndFile(n: NimNode): string
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/help.idx b/cps/help.idx new file mode 100644 index 00000000..1692c128 --- /dev/null +++ b/cps/help.idx @@ -0,0 +1,8 @@ +nimTitle help cps/help.html module cps/help 0 +nim cpsDebug cps/help.html#cpsDebug const cpsDebug 4 +nim comments cps/help.html#comments const comments 5 +nim doc cps/help.html#doc,string proc doc(s: string): NimNode 7 +nim doc cps/help.html#doc,NimNode,string proc doc(n: NimNode; s: string) 14 +nim debug cps/help.html#debug.t,varargs[untyped] template debug(ignore: varargs[untyped]) 21 +nim lineAndFile cps/help.html#lineAndFile.t,NimNode template lineAndFile(n: NimNode): string 22 +nimgrp doc cps/help.html#doc-procs-all proc 7 diff --git a/cps/hooks.html b/cps/hooks.html new file mode 100644 index 00000000..892e9eb0 --- /dev/null +++ b/cps/hooks.html @@ -0,0 +1,293 @@ + + + + + + + +cps/hooks + + + + + + + + + + + + +
+
+

cps/hooks

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

The idea is that you can reimplement one of a few procedures which we will perform a late binding to by name.

+ +
+

Procs

+
+
+
+
proc findColonLit(n: NimNode; s: string; T: typedesc): T:type
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc hook(hook: static[Hook]; a, b: NormNode): NormNode
+
+ + execute the given hook with two arguments + Source   +Edit   + +
+
+
+
proc hook(hook: static[Hook]; n: NormNode): NormNode
+
+ + execute the given hook on the given node + Source   +Edit   + +
+
+ +
+
+
+
proc initFrame(hook: Hook; fun: string; info: LineInfo): NimNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + prepare a tracing frame constructor + Source   +Edit   + +
+
+ +
+
+
+
proc introduce(hook: Hook; n: NormNode) {....raises: [], tags: [], forbids: [].}
+
+ + introduce a hook into the given scope whatfer later use therein + Source   +Edit   + +
+
+
+
proc introduce(n: NormNode; hooks: set[Hook]) {....raises: [], tags: [],
+    forbids: [].}
+
+ + convenience to introduce a set of hooks + Source   +Edit   + +
+
+ +
+
+
+
proc makeLineInfo(n: NimNode): LineInfo {....raises: [ValueError], tags: [],
+    forbids: [].}
+
+ + return a run-time LineInfo into a compile-time LineInfo object + Source   +Edit   + +
+
+ +
+
+
+
proc nameForNode(n: NimNode): string {....raises: [], tags: [], forbids: [].}
+
+ + produce some kind of useful string that names a node + Source   +Edit   + +
+
+ +
+
+
+
proc sym(hook: Hook): Name {....raises: [], tags: [], forbids: [].}
+
+ + produce a symbol|ident for the hook procedure + Source   +Edit   + +
+
+ +
+
+
+
proc updateLineInfoForContinuationStackFrame(c, n: NimNode): NimNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + c holds the continuation symbol, while n is a node with info + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template makeLineInfo(n: LineInfo): NimNode
+
+ + turn a compile-time LineInfo object into a runtime LineInfo object + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/hooks.idx b/cps/hooks.idx new file mode 100644 index 00000000..47c6e8cb --- /dev/null +++ b/cps/hooks.idx @@ -0,0 +1,14 @@ +nimTitle hooks cps/hooks.html module cps/hooks 0 +nim introduce cps/hooks.html#introduce,Hook,NormNode proc introduce(hook: Hook; n: NormNode) 15 +nim introduce cps/hooks.html#introduce,NormNode,set[Hook] proc introduce(n: NormNode; hooks: set[Hook]) 26 +nim findColonLit cps/hooks.html#findColonLit,NimNode,string,typedesc proc findColonLit(n: NimNode; s: string; T: typedesc): T:type 31 +nim makeLineInfo cps/hooks.html#makeLineInfo,NimNode proc makeLineInfo(n: NimNode): LineInfo 47 +nim makeLineInfo cps/hooks.html#makeLineInfo.t,LineInfo template makeLineInfo(n: LineInfo): NimNode 53 +nim sym cps/hooks.html#sym,Hook proc sym(hook: Hook): Name 57 +nim nameForNode cps/hooks.html#nameForNode,NimNode proc nameForNode(n: NimNode): string 78 +nim hook cps/hooks.html#hook,static[Hook],NormNode proc hook(hook: static[Hook]; n: NormNode): NormNode 102 +nim hook cps/hooks.html#hook,static[Hook],NormNode,NormNode proc hook(hook: static[Hook]; a, b: NormNode): NormNode 113 +nim initFrame cps/hooks.html#initFrame,Hook,string,LineInfo proc initFrame(hook: Hook; fun: string; info: LineInfo): NimNode 154 +nim updateLineInfoForContinuationStackFrame cps/hooks.html#updateLineInfoForContinuationStackFrame,NimNode,NimNode proc updateLineInfoForContinuationStackFrame(c, n: NimNode): NimNode 161 +nimgrp introduce cps/hooks.html#introduce-procs-all proc 15 +nimgrp hook cps/hooks.html#hook-procs-all proc 102 diff --git a/cps/normalizedast.html b/cps/normalizedast.html new file mode 100644 index 00000000..7be484e6 --- /dev/null +++ b/cps/normalizedast.html @@ -0,0 +1,4107 @@ + + + + + + + +cps/normalizedast + + + + + + + + + + + + +
+
+

cps/normalizedast

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+
+

Imports

+
+ rewrites +
+
+
+

Types

+
+
+
Call = distinct NormNode
+
+ + opaque sum: call node of some variety, see macros.CallNodes and macros.nnkCallKinds + Source   +Edit   + +
+
+
+
CallKind = Call
+
+ + opaque sum: call node of some variety, see macros.nnkCallKinds, this is an alias as it's not really useful to distinguish the two. + Source   +Edit   + +
+
+
+
Conv = distinct NormNode
+
+ + an nnkConv node + Source   +Edit   + +
+
+
+
DefLike = IdentDefLike | DefVarLet | TupleDefVarLet
+
+ + abstract over any IdentDef or VarTuple from a VarLet or a RoutineParam + Source   +Edit   + +
+
+
+
DotExpr = distinct NormNode
+
+ + nnkDotExpr + Source   +Edit   + +
+
+
+
ExprLike = Name | NormNode
+
+ + abstract over any nim value expression + Source   +Edit   + +
+
+
+
FormalParams = distinct NormNode
+
+ + formal params for a routine, includes return param, then calling params + Source   +Edit   + +
+
+
+
Ident = distinct Name
+
+ + nnkIdent + Source   +Edit   + +
+
+
+
IdentDef = distinct NormNode
+
+ + currently this is nnkIdentDefs mostly in a var let section, in reality these are also for routine and generic param definitions. A normalized IdentDef should only have one identifier. + Source   +Edit   + +
+
+
+
IdentDefLet = distinct IdentDefVarLet
+
+ + opaque sum: identdef defintion from a let section + Source   +Edit   + +
+
+
+
IdentDefLike = IdentDef | RoutineParam | IdentDefVarLet | IdentDefLet |
+    IdentDefVar
+
+ + abstract over a single var or let sections IdentDef, or a routine param definition + Source   +Edit   + +
+
+
+
IdentDefVar = distinct IdentDefVarLet
+
+ + opaque sum: identdef defintion from a var section + Source   +Edit   + +
+
+
+
IdentDefVarLet = distinct DefVarLet
+
+ + opaque sum: identdef defintion from a var or let section + Source   +Edit   + +
+
+
+
LetIdentDef = distinct VarLetIdentDef
+
+ + a let section with a single nnkIdentDefs, never a vartuple + Source   +Edit   + +
+
+
+
LetSection = distinct VarLet
+
+ + a let section, with a single nnkIdentDefs or vartuple + Source   +Edit   + +
+
+
+
LetSectionLike = LetSection | IdentDefLet
+
+ + abstract over various forms of let sections, used to define operations over or allow abstracting over this type class further + Source   +Edit   + +
+
+
+
Name = distinct NormNode
+
+ + opaque sum: Ident | Sym This lets you query and use name like things, which is often required as transformations need to resym, desym, bind, all over the place + Source   +Edit   + +
+
+
+
Pragma = distinct NormNode
+
+ + opaque sum: PragmaStmt, PragmaBlock, and PragmaExpr + Source   +Edit   + +
+
+
+
PragmaAtom = distinct NormNode
+
+ + opaque sum: a single pragma expressions (eg: atom, colon, call, ...) + Source   +Edit   + +
+
+
+
PragmaBlock = distinct Pragma
+
+ + an nnkPragmaBlock, like {.cast(noSideEffect).}: ... + Source   +Edit   + +
+
+
+
PragmaExpr = distinct Pragma
+
+ + an nnkPragmaExpr, such as foo{.praggy, maggy.} + Source   +Edit   + +
+
+
+
PragmaHaver = RoutineDef | ProcDef | Call | TypeExprObj | TypeExprRef | TypeDef
+
+ + abstract over things that have pragmas to provide a uniform interface + Source   +Edit   + +
+
+
+
PragmaLike = PragmaBlock | PragmaExpr | PragmaStmt
+
+ + abstract over any pragma like thing and provide common operations + Source   +Edit   + +
+
+
+
PragmaStmt = distinct Pragma
+
+ + an nnkPragma node, contains 0 or more child PragmaAtom + Source   +Edit   + +
+
+
+
ProcDef = distinct RoutineDef
+
+ + an nnkProcDef node which has been normalized + Source   +Edit   + +
+
+
+
RecursiveNode = NormNode | TypeExpr
+
+ + + Source   +Edit   + +
+
+
+
RoutineDef = distinct NormNode
+
+ + any kind under macros.RoutineNodes which has been normalized + Source   +Edit   + +
+
+
+
RoutineDefLike = RoutineDef | ProcDef
+
+ + + Source   +Edit   + +
+
+
+
RoutineParam = distinct IdentDef
+
+ + each calling params of proc/func/etc definition is an nnkIdentDefs + Source   +Edit   + +
+
+
+
Sym = distinct Name
+
+ + nnkSym + Source   +Edit   + +
+
+
+
TupleDefVarLet = distinct DefVarLet
+
+ + opaque sum: tuple defintion from a var or let section + Source   +Edit   + +
+
+
+
TypeDef = distinct NormNode
+
+ + nnkTypeDef + Source   +Edit   + +
+
+
+
TypeExpr = distinct NormNode
+
+ + opaque sum: see TypeExprKinds the type part of a let or var definition, routine param, or type def or section. + Source   +Edit   + +
+
+
+
TypeExprLike = Name | TypeExpr
+
+ + Any expression that could go into the type part of a routine parameter, the identdef of a var or let section, etc. + Source   +Edit   + +
+
+
+
TypeExprObj = distinct TypeExpr
+
+ + nnkObjTy + Source   +Edit   + +
+
+
+
TypeExprRef = distinct TypeExpr
+
+ + nnkRefTy + Source   +Edit   + +
+
+
+
TypeSection = distinct NormNode
+
+ + nnkTypeSection + Source   +Edit   + +
+
+
+
VarIdentDef = distinct VarLetIdentDef
+
+ + a var section with a single nnkIdentDefs, never a vartuple + Source   +Edit   + +
+
+
+
VarLet = distinct NormNode
+
+ + opqaue sum: a var or let section, with a single define ident or tuple + Source   +Edit   + +
+
+
+
VarLetIdentDef = distinct VarLet
+
+ + opaque sum: a var or let section, but with a single identdefs, eg: var a: int = 10 + Source   +Edit   + +
+
+
+
VarLetIdentDefLike = VarLetIdentDef
+
+ + abstract over let or var sections with identdefs within + Source   +Edit   + +
+
+
+
VarLetLike = VarLet | VarLetTuple | VarLetIdentDef | LetSectionLike |
+    VarSectionLike
+
+ + abstract over various let or var sections types + Source   +Edit   + +
+
+
+
VarLetTuple = distinct VarLet
+
+ + opaque sum: a var or let section, but with a tuple defintion within + Source   +Edit   + +
+
+
+
VarSection = distinct VarLet
+
+ + a var section, with a single nnkIdentDefs or vartuple + Source   +Edit   + +
+
+
+
VarSectionLike = VarSection | IdentDefVar
+
+ + abstract over various var sections types + Source   +Edit   + +
+
+ +
+
+
+

Consts

+
+
+
AccessNodes = {nnkNone..nnkNilLit, nnkBracketExpr, nnkDotExpr, nnkDerefExpr,
+               nnkHiddenAddr..nnkHiddenDeref}
+
+ + AST nodes for operations accessing a resource + Source   +Edit   + +
+
+
+
ConstructNodes = {nnkBracket, nnkObjConstr, nnkTupleConstr}
+
+ + AST nodes for construction operations + Source   +Edit   + +
+
+
+
ConvNodes = {nnkHiddenStdConv..nnkConv}
+
+ + Conversion nodes in typed AST + Source   +Edit   + +
+
+
+
HiddenNodes = {nnkHiddenCallConv, nnkHiddenStdConv, nnkHiddenSubConv,
+               nnkHiddenAddr, nnkHiddenDeref}
+
+ + "Hidden" AST nodes + Source   +Edit   + +
+
+
+
NilNimNode = nil
+
+ + + Source   +Edit   + +
+
+
+
NilNormNode = nil
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
func `$`(a: Name): string {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc `$`(n: NormNode): string {....raises: [], tags: [], forbids: [].}
+
+ + to string + Source   +Edit   + +
+
+ +
+
+
+
func `==`(a, b: Name): bool {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc `==`(a, b: TypeExpr): bool {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + compare two TypeEpxrs and see if they're equal + Source   +Edit   + +
+
+
+
func `==`(a: NimNode; b: Name): bool {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc `[]`[R: RecursiveNode; T, U](n: R; x: HSlice[T, U]): seq[R]
+
+ + grab an inclusive n slice of normalized children + Source   +Edit   + +
+
+
+
proc `[]`[T: RecursiveNode](n: T; i: BackwardsIndex): T
+
+ + grab the i'th child of a normalized node should be normalized itself + Source   +Edit   + +
+
+
+
proc `[]`[T: RecursiveNode](n: T; i: int): T
+
+ + grab the i'th child of a normalized node should be normalized itself + Source   +Edit   + +
+
+ +
+
+
+
proc `[]=`(n: NormNode; i: BackwardsIndex; child: NormNode) {.borrow,
+    ...raises: [], tags: [], forbids: [].}
+
+ + set the i'th child of a normalized node to a normalized child + Source   +Edit   + +
+
+
+
proc `[]=`(n: NormNode; i: int; child: NormNode) {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + set the i'th child of a normalized node to a normalized child + Source   +Edit   + +
+
+ +
+
+
+
proc add(f: NimNode | NormNode; c: NormNode): NormNode {.discardable.}
+
+ + add a child node, and return the parent for further chaining. created in order to fix ambiguous call issues + Source   +Edit   + +
+
+
+
proc add[T: RecursiveNode](f: T; cs: NormalizedVarargs): T {.discardable.}
+
+ + add a child node, and return the parent for further chaining. created in order to fix ambiguous call issues + Source   +Edit   + +
+
+ +
+
+
+
proc addPragma(n: RoutineDefLike; prag: Name)
+
+ + add a pragma (prag) to the definition: {.prag.} + Source   +Edit   + +
+
+
+
proc addPragma(n: RoutineDefLike; prag: Name; pragArg: Name)
+
+ + adds a pragma as follows {.prag: pragArg.} in a colon expression + Source   +Edit   + +
+
+
+
proc addPragma(n: RoutineDefLike; prag: Name; pragArg: NimNode)
+
+ + adds a pragma as follows {.prag: pragArg.} in a colon expression + Source   +Edit   + +
+
+
+
proc addPragma(n: RoutineDefLike; prag: Name; pragArgs: openArray[Name])
+
+ + add pragmas of the form {.raise: [IOError, OSError].} + Source   +Edit   + +
+
+
+
proc addPragma(n: RoutineDefLike; prag: string)
+
+ + add the pragma (prag) as an ident to this definition + Source   +Edit   + +
+
+ +
+
+
+
func asCall(n`gensym107: NormNode): Call {....raises: [], tags: [], forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asCallKind(n`gensym105: NormNode): CallKind {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asConv(n`gensym110: NormNode): Conv {....raises: [], tags: [], forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
proc asIdentDefs(n: NimNode): IdentDef {....raises: [], tags: [], forbids: [].}
+
+ + return an IdentDef or error out + Source   +Edit   + +
+
+ +
+
+
+
func asName(n: NimNode): Name {....raises: [], tags: [], forbids: [].}
+
+ + coerce to Name + Source   +Edit   + +
+
+
+
proc asName(n: string; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + nnkIdent as Name + Source   +Edit   + +
+
+
+
proc asName(n: TypeExpr): Name {....raises: [], tags: [], forbids: [].}
+
+ + coerce to a Name, or error + Source   +Edit   + +
+
+
+
func asName(n`gensym51: NormNode): Name {....raises: [], tags: [], forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asNameAllowEmpty(n: NimNode): Name {....raises: [], tags: [], forbids: [].}
+
+ + coerce to Name, allow nnkEmpty, error out otherwise + Source   +Edit   + +
+
+
+
func asNameAllowEmpty(n`gensym53: NormNode): Name {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
proc asPragmaAtom(n: Name): PragmaAtom {....raises: [], tags: [], forbids: [].}
+
+ + convert a Name to a PragmaAtom + Source   +Edit   + +
+
+ +
+
+
+
func asPragmaBlock(n`gensym103: NormNode): PragmaBlock {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
proc asPragmaStmt(n: Name): PragmaStmt {....raises: [], tags: [], forbids: [].}
+
+ + validate and coerce into a PragmaStmt + Source   +Edit   + +
+
+
+
func asPragmaStmt(n`gensym101: NormNode): PragmaStmt {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asProcDef(n`gensym114: NormNode): ProcDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asRoutineDef(n`gensym112: NormNode): RoutineDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asSym(n`gensym62: NormNode): Sym {....raises: [], tags: [], forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asTypeDef(n`gensym70: NormNode): TypeDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asTypeExpr(n`gensym72: NormNode): TypeExpr {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asTypeExprAllowEmpty(n`gensym74: NormNode): TypeExpr {....raises: [],
+    tags: [], forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asTypeExprObj(n`gensym76: NormNode): TypeExprObj {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asTypeExprRef(n`gensym78: NormNode): TypeExprRef {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
func asTypeSection(n`gensym68: NormNode): TypeSection {....raises: [], tags: [],
+    forbids: [].}
+
+ + coerces a node n or errors out + Source   +Edit   + +
+
+ +
+
+
+
proc asVarLet(n: NimNode): VarLet {....raises: [], tags: [], forbids: [].}
+
+ + return a VarLet if this is a var or let section, otherwise error out + Source   +Edit   + +
+
+ +
+
+
+
proc asVarLetIdentDef(n: VarLet): VarLetIdentDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + return a VarLetIdentDef if the def is an IdentDef, otherwise error out + Source   +Edit   + +
+
+ +
+
+
+
proc asVarLetTuple(n: VarLet): VarLetTuple {....raises: [], tags: [], forbids: [].}
+
+ + return a VarLetTuple if the def is a VarTuple, otherwise error out + Source   +Edit   + +
+
+ +
+
+
+
proc bindName(n: static string): Name
+
+ + bindSym the string as a Name + Source   +Edit   + +
+
+
+
proc bindName(n: static string; rule: static BindSymRule): Name
+
+ + bindSym the string as a Name and specified bind sym rule + Source   +Edit   + +
+
+ +
+
+
+
proc body(n: RoutineDef): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc body=(n: RoutineDef; b: NormNode) {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc childCallToRecoverResult(n: Call; sym, field: NormNode): Call {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + this is used to rewrite continuation calls into their results + Source   +Edit   + +
+
+ +
+
+
+
proc clone(n: ProcDef; body: NimNode = NilNimNode): ProcDef {....raises: [],
+    tags: [], forbids: [].}
+
+ + create a copy of a typed proc which satisfies the compiler + Source   +Edit   + +
+
+
+
func clone(n: VarLet; value: NimNode = NilNimNode): VarLet {....raises: [],
+    tags: [], forbids: [].}
+
+ + clone a VarLet but with value changed + Source   +Edit   + +
+
+ +
+
+
+
proc copy(n: NormNode): NormNode {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc copyLineInfo(arg, info: NormNode) {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc copyLineInfo(arg: NormNode; info: NimNode) {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc copyNimNode(n: NormNode): NormNode {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc copyNimTree(n: NormNode): NormNode {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func def(n: VarLetLike): DefVarLet | TupleDefVarLet
+
+ + an IdentDef or VarTuple as a not very specific type DefVarLet for VarLetTuple a more specific type TupleDefVarLet is returned + Source   +Edit   + +
+
+ +
+
+
+
proc desym(n: Call) {....raises: [], tags: [], forbids: [].}
+
+ + desyms the callee name + Source   +Edit   + +
+
+
+
proc desym(n: Name): Name {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + ensures that Name is an nnkIdent + Source   +Edit   + +
+
+
+
proc desym[T: Desymable](n: T; sym: NimNode | Name): T
+
+ + desym all occurences of a specific sym + Source   +Edit   + +
+
+ +
+
+
+
func eqIdent(a: Name | NimNode; b: distinct Name | NimNode): bool
+
+ + bridge eqIdent from macros + Source   +Edit   + +
+
+
+
func eqIdent(a: Name | NimNode; b: string): bool
+
+ + bridge eqIdent from macros + Source   +Edit   + +
+
+
+
func eqIdent(a: NormNode; b: Name): bool {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func errorGot(msg: string; n: NormNode; got = treeRepr(NimNode(n))) {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + useful for error messages + Source   +Edit   + +
+
+ +
+
+
+
proc expr(n: Conv): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + the expression being converted + Source   +Edit   + +
+
+ +
+
+
+
proc findChildRecursive(n: NormNode; cmp: proc (n: NormNode): bool): NormNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ +

finds the first child node where cmp(node) returns true, recursively

+

returns nil if none found

+ + Source   +Edit   + +
+
+ +
+
+
+
proc firstCallParam(n: RoutineDef): RoutineParam {....raises: [], tags: [],
+    forbids: [].}
+
+ + returns the first call param for this proc def, useful due to CPS proc often just have one continuation parameter that we access often. + Source   +Edit   + +
+
+ +
+
+
+
func formalParams(n: RoutineDef): FormalParams {....raises: [], tags: [],
+    forbids: [].}
+
+ + fetch the formal params, first one is the return param + Source   +Edit   + +
+
+ +
+
+
+
proc formalParams=(n: RoutineDef; f: FormalParams) {....raises: [], tags: [],
+    forbids: [].}
+
+ + set the formal params for this routine, first one is the return param + Source   +Edit   + +
+
+ +
+
+
+
proc genField(ident = ""): Name {....deprecated: "pending https://github.com/nim-lang/Nim/issues/17851",
+                                  raises: [], tags: [], forbids: [].}
+
+
+ Deprecated: pending https://github.com/nim-lang/Nim/issues/17851 +
+ + generate a unique field to put inside an object definition + Source   +Edit   + +
+
+ +
+
+
+
proc genProcName(a, b: string; info = NilNormNode): Name {....raises: [ValueError],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc genProcName(a: string; info = NilNormNode): Name {....deprecated,
+    raises: [ValueError], tags: [], forbids: [].}
+
+
+ Deprecated +
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc genSymField(n: string; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + genSym an nskField + Source   +Edit   + +
+
+ +
+
+
+
proc genSymLet(n: string = ""; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + genSym an nskLet + Source   +Edit   + +
+
+ +
+
+
+
proc genSymProc(n: string; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + genSym an nskProc + Source   +Edit   + +
+
+ +
+
+
+
proc genSymType(n: string; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + genSym an nskType + Source   +Edit   + +
+
+ +
+
+
+
proc genSymUnknown(n: string; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + genSym an nskUnknown + Source   +Edit   + +
+
+ +
+
+
+
proc genSymVar(n: string = ""; info: NormNode = NilNormNode): Name {....raises: [],
+    tags: [], forbids: [].}
+
+ + genSym an nskVar + Source   +Edit   + +
+
+ +
+
+
+
proc genTypeName(a, b: string; info = NilNormNode): Name {....raises: [ValueError],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getImpl(n: NormNode): NormNode {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + the implementaiton of a normalized node should be normalized itself + Source   +Edit   + +
+
+ +
+
+
+
proc getPragmaName(n: NimNode): NimNode {.
+    ...deprecated: "Replace with Pragma version", raises: [], tags: [], forbids: [].}
+
+
+ Deprecated: Replace with Pragma version +
+ + retrieve the symbol/identifier from the child node of a nnkPragma + Source   +Edit   + +
+
+
+
proc getPragmaName(n: PragmaAtom): Name {....raises: [], tags: [], forbids: [].}
+
+ + retrieve the symbol/identifier from the child node of a PragmaAtom, or if it's an atom then return itself. + Source   +Edit   + +
+
+ +
+
+
+
proc getTypeInst(n: NormNode): TypeExpr {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + return the type instance, via getTypeInst of a NimNode + Source   +Edit   + +
+
+ +
+
+
+
func hasImpl(n: Call): bool {....raises: [], tags: [], forbids: [].}
+
+ + the callee's name is a symbol and a routine impl is present + Source   +Edit   + +
+
+ +
+
+
+
proc hasPragma(n: NormNode; s: static[string]): bool
+
+ + true if the n holds the pragma s + Source   +Edit   + +
+
+
+
func hasPragma(n: PragmaHaver; s: static[string]): bool
+
+ + true if the n holds the pragma s + Source   +Edit   + +
+
+
+
func hasPragma(n: PragmaLike; s: static[string]): bool
+
+ + true if the n holds the pragma s + Source   +Edit   + +
+
+ +
+
+
+
func hasType(n: DefLike): bool
+
+ + has a non-Empty type (typ) defined + Source   +Edit   + +
+
+ +
+
+
+
func hasValue(n: DefLike): bool
+
+ + has a non-Empty initial value defined for the ident, sym or tuple Yes, proc, you ARE a good proc. You have value, hasValue, in fact. + Source   +Edit   + +
+
+
+
func hasValue(n: VarLetLike): bool
+
+ + whether an initial value has been specified + Source   +Edit   + +
+
+ +
+
+
+
func identdef(n: VarLetIdentDefLike): IdentDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + retrieve the inner IdentDef + Source   +Edit   + +
+
+ +
+
+
+
func impl(n: Call): RoutineDef {....raises: [], tags: [], forbids: [].}
+
+ + return the RoutineDef associated to this Call n + Source   +Edit   + +
+
+ +
+
+
+
func inferTypFromImpl(n: DefLike): TypeExpr
+
+ + returns the typ if specified or uses macro.getTypeImpl to infer it + Source   +Edit   + +
+
+
+
func inferTypFromImpl(n: VarLetIdentDefLike): TypeExpr {....raises: [], tags: [],
+    forbids: [].}
+
+ + returns the typ if specified or uses macro.getTypeImpl to infer it + Source   +Edit   + +
+
+ +
+
+
+
func isExported(n: Name): bool {....raises: [], tags: [], forbids: [].}
+
+ + true if this has been exported + Source   +Edit   + +
+
+ +
+
+
+
func isNil(n: Name): bool {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
func isNil(n: TypeExpr): bool {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + true if nil + Source   +Edit   + +
+
+ +
+
+
+
func isSymbol(n: Name): bool {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func isTuple(n: VarLetLike): bool
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func kind(n: NormNode): NimNodeKind {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + the kind (NimNodeKind) of the underlying NimNode + Source   +Edit   + +
+
+
+
func kind(n: VarLetLike): NimNodeKind
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func last[T: RecursiveNode](n: T): T
+
+ + last child + Source   +Edit   + +
+
+ +
+
+
+
func len(n: NormNode): int {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + number of children + Source   +Edit   + +
+
+ +
+
+
+
func name(n: Call): Name {....raises: [], tags: [], forbids: [].}
+
+ + callee name + Source   +Edit   + +
+
+
+
func name(n: IdentDefLike): Name
+
+ + retrieve the name of this IdentDefLike + Source   +Edit   + +
+
+
+
func name(n: PragmaExpr): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
func name(n: RoutineDef): Name {....raises: [], tags: [], forbids: [].}
+
+ + get the name of this RoutineDef + Source   +Edit   + +
+
+
+
func name(n: VarLetIdentDefLike): Name {....raises: [], tags: [], forbids: [].}
+
+ + Name (ident|sym) of the identifer, as we only have a single identdefs it will have the name + Source   +Edit   + +
+
+ +
+
+
+
proc name=(callee: Call; newName: Name) {....raises: [], tags: [], forbids: [].}
+
+ + set the callee's name to newName + Source   +Edit   + +
+
+
+
proc name=(n: RoutineDef; name: Name) {....raises: [], tags: [], forbids: [].}
+
+ + set the name of this RoutineDef + Source   +Edit   + +
+
+ +
+
+
+
proc newAssignment(l`gensym67: ExprLike; r`gensym67: distinct ExprLike): NormNode
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc newCall(n: Name; args: AnyNodeVarargs): Call {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a new call, with n as name some args + Source   +Edit   + +
+
+
+
proc newCall(n: NormNode; args: AnyNodeVarargs): Call {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a new call, with n as name some args + Source   +Edit   + +
+
+
+
proc newCall(n: string; args: AnyNodeVarargs): Call {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a new call, with n as and ident name, and a single arg + Source   +Edit   + +
+
+ +
+
+
+
proc newColonExpr(l`gensym66: ExprLike; r`gensym66: distinct ExprLike): NormNode
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc newDotExpr(l`gensym65: ExprLike; r`gensym65: distinct ExprLike): NormNode
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc newEmptyNormNode(): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + create a new empty node (nnkEmpty) + Source   +Edit   + +
+
+ +
+
+
+
proc newFormalParams(ret: TypeExpr; ps: varargs[IdentDef]): FormalParams {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + create new formal params, with a return of ret, and calling params ps + Source   +Edit   + +
+
+ +
+
+
+
proc newIdentDef(n: Name; t: TypeExprLike; val = newEmptyNode()): IdentDef
+
+ + create a single assignment nnkIdentDefs, we drop the plural to indicate the singleton nature + Source   +Edit   + +
+
+
+
proc newIdentDef(n: Name; val: NormNode): IdentDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a single assignment nnkIdentDefs, we drop the plural to indicate the singleton nature + Source   +Edit   + +
+
+
+
proc newIdentDef(n: string; t: TypeExprLike; val = newEmptyNode()): IdentDef
+
+ + create a single assignment nnkIdentDefs, we drop the plural to indicate the singleton nature + Source   +Edit   + +
+
+ +
+
+
+
proc newIdentDefVar(i: IdentDef): IdentDefVar {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a var section with an identdef ie: newVarSection(i), where i is 'foo: int = 2` -> var foo: int = 2 + Source   +Edit   + +
+
+
+
proc newIdentDefVar(n: Name; t: TypeExprLike; val = newEmptyNode()): IdentDefVar
+
+ + create a var section with an identdef, eg: n: t = val + Source   +Edit   + +
+
+ +
+
+
+
proc newLetIdentDef(i: IdentDef): LetIdentDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a let section with an identdef ie: newLetSection(i), where i is 'foo: int = 2` -> let foo: int = 2 + Source   +Edit   + +
+
+
+
proc newLetIdentDef(n: Name; t: TypeExprLike; val = newEmptyNode()): LetIdentDef
+
+ + create a let section with an identdef, eg: n: t = val + Source   +Edit   + +
+
+
+
proc newLetIdentDef(n: Name; val: NormNode): LetIdentDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc newPragmaColonExpr(n: static[string]; r: NormNode): PragmaAtom
+
+ + create a new PragmaAtom that's a colon expression + Source   +Edit   + +
+
+ +
+
+
+
proc newPragmaStmt(es: varargs[PragmaAtom]): PragmaStmt {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a new PragmaStmt node with es pragma exprs, but returns an empty node if none are provided. + Source   +Edit   + +
+
+
+
proc newPragmaStmt(n: Name): PragmaStmt {....raises: [], tags: [], forbids: [].}
+
+ + create a new PragmaStmt node with n as a PragmaAtom + Source   +Edit   + +
+
+ +
+
+
+
proc newPragmaStmtWithInfo(inf: NormNode; es: varargs[PragmaAtom]): PragmaStmt {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + create a new PragmaStmt node with es pragma exprs, but returns an empty node if none are provided, and sets the line info + Source   +Edit   + +
+
+ +
+
+
+
proc newProcDef(name: Name; retType: TypeExpr; callParams: varargs[IdentDef]): ProcDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + create a new proc def with name, returnt type, and calling params and an empty body (nnkStmtList) + Source   +Edit   + +
+
+ +
+
+
+
proc newRefType(n: Name): TypeExprRef {....raises: [], tags: [], forbids: [].}
+
+ + create a new ref type from n + Source   +Edit   + +
+
+ +
+
+
+
proc newStmtList(stmts: AnyNodeVarargs): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a new normalized statement + Source   +Edit   + +
+
+ +
+
+
+
proc newTree(kind: NimNodeKind; n: AnyNodeVarargs): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + creates a new tree (newTree) of kind, with child n + Source   +Edit   + +
+
+ +
+
+
+
proc newVarIdentDef(i: IdentDef): VarIdentDef {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a var section with an identdef ie: newVarSection(i), where i is 'foo: int = 2` -> var foo: int = 2 + Source   +Edit   + +
+
+ +
+
+
+
proc newVarLetIdentDef(kind: NimNodeKind; i: IdentDef): VarLetIdentDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + create a new VarLetIdentDef + Source   +Edit   + +
+
+
+
proc newVarLetIdentDef(kind: NimNodeKind; name: Name; typ: TypeExprLike;
+                       val: NimNode): VarLetIdentDef
+
+ + create a new VarLetIdentDef + Source   +Edit   + +
+
+ +
+
+
+
proc newVarSection(i: IdentDef): VarSection {....raises: [], tags: [], forbids: [].}
+
+ + create a var section with an identdef ie: newVarSection(i), where i is 'foo: int = 2` -> var foo: int = 2 + Source   +Edit   + +
+
+
+
proc newVarSection(n: Name; t: TypeExprLike; val = newEmptyNode()): VarSection
+
+ + create a var section with an identdef, eg: n: t = val + Source   +Edit   + +
+
+ +
+
+
+
proc normalizeCall(n: NimNode): Call {....raises: [Exception], tags: [RootEffect],
+                                       forbids: [].}
+
+ + ensure this is a normalized procd definition + Source   +Edit   + +
+
+ +
+
+
+
proc normalizeProcDef(n: NimNode): ProcDef {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + ensure this is a normalized procd definition + Source   +Edit   + +
+
+ +
+
+
+
proc onlyNormalizedNode[T: distinct](n: T): NormNode
+
+ + used for conversion in an vararg scenarios primarily + Source   +Edit   + +
+
+ +
+
+
+
proc postfix(n: Name; op: string): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func pragma(n: PragmaHaver): PragmaLike
+
+ + fetch all pragma declared on this routine definition or a callee + Source   +Edit   + +
+
+ +
+
+
+
proc pragma=(n: ProcDef; p: PragmaStmt) {....raises: [], tags: [], forbids: [].}
+
+ + set the pragma + Source   +Edit   + +
+
+
+
proc pragma=(n: RoutineDef; p: PragmaStmt) {....raises: [], tags: [], forbids: [].}
+
+ + set the pragma for this routine, replace the previous one entirely + Source   +Edit   + +
+
+ +
+
+
+
proc prependArg(n: Call; arg: NormNode) {....raises: [], tags: [], forbids: [].}
+
+ + add an argument to the call in the first position of the call + Source   +Edit   + +
+
+ +
+
+
+
proc resym(fragment: NormNode; sym, replacement: Name): NormNode {.borrow,
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + replace sym in the AST fragment with the replacement + Source   +Edit   + +
+
+ +
+
+
+
func returnParam(n: ProcDef): TypeExpr {....raises: [], tags: [], forbids: [].}
+
+ + the return param or empty if void + Source   +Edit   + +
+
+ +
+
+
+
proc returnParam=(n: ProcDef; ret: Name) {....raises: [], tags: [], forbids: [].}
+
+ + set the return param + Source   +Edit   + +
+
+ +
+
+
+
proc sameType(a, b: TypeExpr): bool {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + compare the type associated with the TypeExprs and see if they're equal + Source   +Edit   + +
+
+ +
+
+
+
proc sinkAnnotated(n: NormNode): TypeExpr {....raises: [], tags: [], forbids: [].}
+
+ + create a sink annotated type expression from n + Source   +Edit   + +
+
+ +
+
+
+
func smartSniffer(n: VarLetLike): TypeExpr
+
+ + perform some type-fu for tuple type sniffing + Source   +Edit   + +
+
+ +
+
+
+
func strVal(n: Name): string {.borrow, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc typ(n: Conv): TypeExpr {....raises: [], tags: [], forbids: [].}
+
+ + the type being converted to + Source   +Edit   + +
+
+
+
func typ(n: DefLike): TypeExpr
+
+ + get the type of this identdef or vartuple + Source   +Edit   + +
+
+
+
func typ(n: VarLetLike): TypeExpr
+
+ + the type of this definition (IdentDef or VarTuple) + Source   +Edit   + +
+
+ +
+
+
+
func typeInst(n: Name): TypeExpr {....deprecated: "A Name can be a bare ident and entirely untyped",
+                                   raises: [], tags: [], forbids: [].}
+
+
+ Deprecated: A Name can be a bare ident and entirely untyped +
+ + gets the type via getTypeInst + Source   +Edit   + +
+
+
+
func typeInst(n: Sym): TypeExpr {....raises: [], tags: [], forbids: [].}
+
+ + gets the type via getTypeInst + Source   +Edit   + +
+
+ +
+
+
+
proc typeKind(n: TypeExpr): NimTypeKind {.borrow, ...raises: [], tags: [],
+    forbids: [].}
+
+ + get the type kind of a type expr + Source   +Edit   + +
+
+ +
+
+
+
proc upgradeToNormalizedNode[T](n: T): NormNode
+
+ + used for conversion in varargs, will convert NimNode to NormNode + Source   +Edit   + +
+
+ +
+
+
+
func val(n: DefLike): NormNode
+
+ + get the value of this identdef or vartuple + Source   +Edit   + +
+
+
+
func val(n: VarLetLike): NormNode
+
+ + the ident or sym being defined, or tuple being defined + Source   +Edit   + +
+
+ +
+
+
+
proc wrap(kind: NimNodeKind; n: NormNode): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + wraps a node n within a new node of kind + Source   +Edit   + +
+
+ +
+ +
+
+
+

Iterators

+
+
+
+
iterator callingParams(n: ProcDef): RoutineParam {....raises: [], tags: [],
+    forbids: [].}
+
+ + iterate over formal parameters used to call this routine, excludes the return parameter. + Source   +Edit   + +
+
+ +
+
+
+
iterator indexNamePairs(n: VarLetTuple): (int, Name) {....raises: [], tags: [],
+    forbids: [].}
+
+ + return the names of fields on the lhs of a var/let tuple assignment + Source   +Edit   + +
+
+ +
+
+
+
iterator items(n: NormNode): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + iterate through the kiddos + Source   +Edit   + +
+
+
+
iterator items(n: PragmaLike): PragmaAtom
+
+ + fetch the individual atoms + Source   +Edit   + +
+
+ +
+
+
+
iterator pairs(n: NormNode): (int, NormNode) {....raises: [], tags: [], forbids: [].}
+
+ + iterate through the kiddos, but also get their index + Source   +Edit   + +
+
+ +
+ +
+
+
+

Converters

+
+
+
+
converter cCallToNormNode(n`gensym26: Call): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cConvToNormNode(n`gensym27: Conv): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cDefVarLetToNormNode(n`gensym40: DefVarLet): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cFormalParamsToNormNode(n`gensym33: FormalParams): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cIdentDefLetToIdentDef(n`gensym43: IdentDefLet): IdentDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cIdentDefLetToNormNode(n`gensym41: IdentDefLet): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cIdentDefToNimNode(n`gensym1: IdentDef): NimNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cIdentDefToNormNode(n`gensym30: IdentDef): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cIdentDefVarToIdentDef(n`gensym44: IdentDefVar): IdentDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cIdentToNimNode(n`gensym2: Ident): NimNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cLetIdentDefToVarLetIdentDef(n`gensym46: LetIdentDef): VarLetIdentDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cLetSectionToNormNode(n`gensym36: LetSection): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cNameToNormNode(n`gensym24: Name): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cNormNodeToNimNode(n`gensym0: NormNode): NimNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cPragmaAtomToNormNode(n`gensym29: PragmaAtom): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cPragmaStmtToNormNode(n`gensym28: PragmaStmt): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cProcDefToNormNode(n`gensym32: ProcDef): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cProcDefToRoutineDef(n`gensym48: ProcDef): RoutineDef {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cRoutineDefToNimNode(n`gensym4: RoutineDef): NimNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cRoutineDefToNormNode(n`gensym31: RoutineDef): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cRoutineParamToIdentDef(n`gensym45: RoutineParam): IdentDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cRoutineParamToNormNode(n`gensym34: RoutineParam): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cSymToName(n`gensym64: Sym): Name {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cSymToNormNode(n`gensym42: Sym): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cTypeExprRefToTypeExpr(n`gensym49: TypeExprRef): TypeExpr {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cTypeExprToNormNode(n`gensym25: TypeExpr): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cVarIdentDefToVarLetIdentDef(n`gensym47: VarIdentDef): VarLetIdentDef {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cVarLetIdentDefToNormNode(n`gensym38: VarLetIdentDef): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cVarLetToNormNode(n`gensym37: VarLet): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cVarLetTupleToNormNode(n`gensym39: VarLetTuple): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cVarSectionToNimNode(n`gensym3: VarSection): NimNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter cVarSectionToNormNode(n`gensym35: VarSection): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
converter seqNormalizedToSeqNimNode(n: seq[NormNode]): seq[NimNode] {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + convert a seq[NormNode] to seq[NimNode] for ease of use + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template copyNodeAndTransformIt(n: NimNode; body: untyped): untyped
+
+ + copies a node n into it, transforms it with body, and provides it as the expression result. Assumes n and it are Normalized. + Source   +Edit   + +
+
+ +
+
+
+
template dot(a, b: NormNode): NormNode
+
+ + for constructing foo.bar + Source   +Edit   + +
+
+
+
template dot(a: NormNode; b: string): NormNode
+
+ + for constructing .(foo, "bar") + Source   +Edit   + +
+
+ +
+
+
+
template findChild(n: NormNode; cond: untyped): NormNode
+
+ + finds the first child node matching the condition or nil + Source   +Edit   + +
+
+ +
+
+
+
template hash(n: Name): Hash
+
+ + hash Name nodes, necessary for what we do in environment + Source   +Edit   + +
+
+
+
template hash(n: NormNode): Hash
+
+ + hash NormNode, necessary for what we do in environment + Source   +Edit   + +
+
+ +
+
+
+
template ifCallKindThenIt(n: NormNode; body: untyped)
+
+ + if n is a nnCallKinds then run the body with it as Call + Source   +Edit   + +
+
+ +
+
+
+
template ifCallThenIt(n: NormNode; body: untyped)
+
+ + if n is a CallNodes then run the body with it as Call + Source   +Edit   + +
+
+ +
+
+
+
template newNodeAndTransformIt(n: NimNode; body: untyped): untyped
+
+ + creates a node it, transformed by the body, and provides the result. Info and kind of node are derived from n. This proc is useful for when type information of n needs to be wiped, otherwise use copyNodeAndTransformIt. Assumes n and it are Normalized. + Source   +Edit   + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + diff --git a/cps/normalizedast.idx b/cps/normalizedast.idx new file mode 100644 index 00000000..c228e1d5 --- /dev/null +++ b/cps/normalizedast.idx @@ -0,0 +1,299 @@ +nimTitle normalizedast cps/normalizedast.html module cps/normalizedast 0 +nim NilNormNode cps/normalizedast.html#NilNormNode const NilNormNode 12 +nim NilNimNode cps/normalizedast.html#NilNimNode const NilNimNode 13 +nim Name cps/normalizedast.html#Name type Name 71 +nim Ident cps/normalizedast.html#Ident type Ident 76 +nim Sym cps/normalizedast.html#Sym type Sym 78 +nim DotExpr cps/normalizedast.html#DotExpr type DotExpr 81 +nim TypeExpr cps/normalizedast.html#TypeExpr type TypeExpr 84 +nim TypeExprObj cps/normalizedast.html#TypeExprObj type TypeExprObj 88 +nim TypeExprRef cps/normalizedast.html#TypeExprRef type TypeExprRef 90 +nim IdentDef cps/normalizedast.html#IdentDef type IdentDef 93 +nim RoutineDef cps/normalizedast.html#RoutineDef type RoutineDef 98 +nim ProcDef cps/normalizedast.html#ProcDef type ProcDef 100 +nim FormalParams cps/normalizedast.html#FormalParams type FormalParams 103 +nim RoutineParam cps/normalizedast.html#RoutineParam type RoutineParam 105 +nim Call cps/normalizedast.html#Call type Call 108 +nim CallKind cps/normalizedast.html#CallKind type CallKind 111 +nim Conv cps/normalizedast.html#Conv type Conv 115 +nim Pragma cps/normalizedast.html#Pragma type Pragma 118 +nim PragmaStmt cps/normalizedast.html#PragmaStmt type PragmaStmt 120 +nim PragmaBlock cps/normalizedast.html#PragmaBlock type PragmaBlock 122 +nim PragmaExpr cps/normalizedast.html#PragmaExpr type PragmaExpr 124 +nim PragmaAtom cps/normalizedast.html#PragmaAtom type PragmaAtom 127 +nim TypeSection cps/normalizedast.html#TypeSection type TypeSection 130 +nim TypeDef cps/normalizedast.html#TypeDef type TypeDef 132 +nim VarLet cps/normalizedast.html#VarLet type VarLet 148 +nim VarLetTuple cps/normalizedast.html#VarLetTuple type VarLetTuple 151 +nim VarLetIdentDef cps/normalizedast.html#VarLetIdentDef type VarLetIdentDef 153 +nim LetSection cps/normalizedast.html#LetSection type LetSection 156 +nim VarSection cps/normalizedast.html#VarSection type VarSection 158 +nim VarIdentDef cps/normalizedast.html#VarIdentDef type VarIdentDef 161 +nim LetIdentDef cps/normalizedast.html#LetIdentDef type LetIdentDef 163 +nim IdentDefVarLet cps/normalizedast.html#IdentDefVarLet type IdentDefVarLet 168 +nim TupleDefVarLet cps/normalizedast.html#TupleDefVarLet type TupleDefVarLet 170 +nim IdentDefLet cps/normalizedast.html#IdentDefLet type IdentDefLet 172 +nim IdentDefVar cps/normalizedast.html#IdentDefVar type IdentDefVar 174 +nim TypeExprLike cps/normalizedast.html#TypeExprLike type TypeExprLike 178 +nim errorGot cps/normalizedast.html#errorGot,string,NormNode proc errorGot(msg: string; n: NormNode; got = treeRepr(NimNode(n))) 199 +nim normalizeProcDef cps/normalizedast.html#normalizeProcDef,NimNode proc normalizeProcDef(n: NimNode): ProcDef 203 +nim normalizeCall cps/normalizedast.html#normalizeCall,NimNode proc normalizeCall(n: NimNode): Call 208 +nim copy cps/normalizedast.html#copy,NormNode proc copy(n: NormNode): NormNode 215 +nim copyNimNode cps/normalizedast.html#copyNimNode,NormNode proc copyNimNode(n: NormNode): NormNode 216 +nim copyNimTree cps/normalizedast.html#copyNimTree,NormNode proc copyNimTree(n: NormNode): NormNode 217 +nim ConvNodes cps/normalizedast.html#ConvNodes const ConvNodes 220 +nim AccessNodes cps/normalizedast.html#AccessNodes const AccessNodes 223 +nim ConstructNodes cps/normalizedast.html#ConstructNodes const ConstructNodes 227 +nim HiddenNodes cps/normalizedast.html#HiddenNodes const HiddenNodes 230 +nim cNormNodeToNimNode cps/normalizedast.html#cNormNodeToNimNode.c,NormNode converter cNormNodeToNimNode(n`gensym0: NormNode): NimNode 242 +nim cIdentDefToNimNode cps/normalizedast.html#cIdentDefToNimNode.c,IdentDef converter cIdentDefToNimNode(n`gensym1: IdentDef): NimNode 242 +nim cIdentToNimNode cps/normalizedast.html#cIdentToNimNode.c,Ident converter cIdentToNimNode(n`gensym2: Ident): NimNode 242 +nim cVarSectionToNimNode cps/normalizedast.html#cVarSectionToNimNode.c,VarSection converter cVarSectionToNimNode(n`gensym3: VarSection): NimNode 242 +nim cRoutineDefToNimNode cps/normalizedast.html#cRoutineDefToNimNode.c,RoutineDef converter cRoutineDefToNimNode(n`gensym4: RoutineDef): NimNode 262 +nim cNameToNormNode cps/normalizedast.html#cNameToNormNode.c,Name converter cNameToNormNode(n`gensym24: Name): NormNode 256 +nim cTypeExprToNormNode cps/normalizedast.html#cTypeExprToNormNode.c,TypeExpr converter cTypeExprToNormNode(n`gensym25: TypeExpr): NormNode 256 +nim cCallToNormNode cps/normalizedast.html#cCallToNormNode.c,Call converter cCallToNormNode(n`gensym26: Call): NormNode 256 +nim cConvToNormNode cps/normalizedast.html#cConvToNormNode.c,Conv converter cConvToNormNode(n`gensym27: Conv): NormNode 256 +nim cPragmaStmtToNormNode cps/normalizedast.html#cPragmaStmtToNormNode.c,PragmaStmt converter cPragmaStmtToNormNode(n`gensym28: PragmaStmt): NormNode 256 +nim cPragmaAtomToNormNode cps/normalizedast.html#cPragmaAtomToNormNode.c,PragmaAtom converter cPragmaAtomToNormNode(n`gensym29: PragmaAtom): NormNode 256 +nim cIdentDefToNormNode cps/normalizedast.html#cIdentDefToNormNode.c,IdentDef converter cIdentDefToNormNode(n`gensym30: IdentDef): NormNode 256 +nim cRoutineDefToNormNode cps/normalizedast.html#cRoutineDefToNormNode.c,RoutineDef converter cRoutineDefToNormNode(n`gensym31: RoutineDef): NormNode 256 +nim cProcDefToNormNode cps/normalizedast.html#cProcDefToNormNode.c,ProcDef converter cProcDefToNormNode(n`gensym32: ProcDef): NormNode 256 +nim cFormalParamsToNormNode cps/normalizedast.html#cFormalParamsToNormNode.c,FormalParams converter cFormalParamsToNormNode(n`gensym33: FormalParams): NormNode 256 +nim cRoutineParamToNormNode cps/normalizedast.html#cRoutineParamToNormNode.c,RoutineParam converter cRoutineParamToNormNode(n`gensym34: RoutineParam): NormNode 256 +nim cVarSectionToNormNode cps/normalizedast.html#cVarSectionToNormNode.c,VarSection converter cVarSectionToNormNode(n`gensym35: VarSection): NormNode 256 +nim cLetSectionToNormNode cps/normalizedast.html#cLetSectionToNormNode.c,LetSection converter cLetSectionToNormNode(n`gensym36: LetSection): NormNode 256 +nim cVarLetToNormNode cps/normalizedast.html#cVarLetToNormNode.c,VarLet converter cVarLetToNormNode(n`gensym37: VarLet): NormNode 256 +nim cVarLetIdentDefToNormNode cps/normalizedast.html#cVarLetIdentDefToNormNode.c,VarLetIdentDef converter cVarLetIdentDefToNormNode(n`gensym38: VarLetIdentDef): NormNode 256 +nim cVarLetTupleToNormNode cps/normalizedast.html#cVarLetTupleToNormNode.c,VarLetTuple converter cVarLetTupleToNormNode(n`gensym39: VarLetTuple): NormNode 256 +nim cDefVarLetToNormNode cps/normalizedast.html#cDefVarLetToNormNode.c,DefVarLet converter cDefVarLetToNormNode(n`gensym40: DefVarLet): NormNode 256 +nim cIdentDefLetToNormNode cps/normalizedast.html#cIdentDefLetToNormNode.c,IdentDefLet converter cIdentDefLetToNormNode(n`gensym41: IdentDefLet): NormNode 256 +nim cSymToNormNode cps/normalizedast.html#cSymToNormNode.c,Sym converter cSymToNormNode(n`gensym42: Sym): NormNode 256 +nim cIdentDefLetToIdentDef cps/normalizedast.html#cIdentDefLetToIdentDef.c,IdentDefLet converter cIdentDefLetToIdentDef(n`gensym43: IdentDefLet): IdentDef 274 +nim cIdentDefVarToIdentDef cps/normalizedast.html#cIdentDefVarToIdentDef.c,IdentDefVar converter cIdentDefVarToIdentDef(n`gensym44: IdentDefVar): IdentDef 275 +nim cRoutineParamToIdentDef cps/normalizedast.html#cRoutineParamToIdentDef.c,RoutineParam converter cRoutineParamToIdentDef(n`gensym45: RoutineParam): IdentDef 276 +nim cLetIdentDefToVarLetIdentDef cps/normalizedast.html#cLetIdentDefToVarLetIdentDef.c,LetIdentDef converter cLetIdentDefToVarLetIdentDef(n`gensym46: LetIdentDef): VarLetIdentDef 277 +nim cVarIdentDefToVarLetIdentDef cps/normalizedast.html#cVarIdentDefToVarLetIdentDef.c,VarIdentDef converter cVarIdentDefToVarLetIdentDef(n`gensym47: VarIdentDef): VarLetIdentDef 278 +nim cProcDefToRoutineDef cps/normalizedast.html#cProcDefToRoutineDef.c,ProcDef converter cProcDefToRoutineDef(n`gensym48: ProcDef): RoutineDef 279 +nim cTypeExprRefToTypeExpr cps/normalizedast.html#cTypeExprRefToTypeExpr.c,TypeExprRef converter cTypeExprRefToTypeExpr(n`gensym49: TypeExprRef): TypeExpr 280 +nim newEmptyNormNode cps/normalizedast.html#newEmptyNormNode proc newEmptyNormNode(): NormNode 302 +nim onlyNormalizedNode cps/normalizedast.html#onlyNormalizedNode,T proc onlyNormalizedNode[T: distinct](n: T): NormNode 306 +nim upgradeToNormalizedNode cps/normalizedast.html#upgradeToNormalizedNode,T proc upgradeToNormalizedNode[T](n: T): NormNode 313 +nim desym cps/normalizedast.html#desym,T, proc desym[T: Desymable](n: T; sym: NimNode | Name): T 327 +nim hash cps/normalizedast.html#hash.t,NormNode template hash(n: NormNode): Hash 333 +nim `$` cps/normalizedast.html#$,NormNode proc `$`(n: NormNode): string 337 +nim len cps/normalizedast.html#len,NormNode proc len(n: NormNode): int 341 +nim kind cps/normalizedast.html#kind,NormNode proc kind(n: NormNode): NimNodeKind 344 +nim add cps/normalizedast.html#add,,NormNode proc add(f: NimNode | NormNode; c: NormNode): NormNode 347 +nim findChild cps/normalizedast.html#findChild.t,NormNode,untyped template findChild(n: NormNode; cond: untyped): NormNode 354 +nim findChildRecursive cps/normalizedast.html#findChildRecursive,NormNode,proc(NormNode) proc findChildRecursive(n: NormNode; cmp: proc (n: NormNode): bool): NormNode 358 +nim getImpl cps/normalizedast.html#getImpl,NormNode proc getImpl(n: NormNode): NormNode 370 +nim getTypeInst cps/normalizedast.html#getTypeInst,NormNode proc getTypeInst(n: NormNode): TypeExpr 373 +nim RecursiveNode cps/normalizedast.html#RecursiveNode type RecursiveNode 377 +nim add cps/normalizedast.html#add,T,NormalizedVarargs proc add[T: RecursiveNode](f: T; cs: NormalizedVarargs): T 379 +nim `[]` cps/normalizedast.html#[],T,int proc `[]`[T: RecursiveNode](n: T; i: int): T 385 +nim `[]` cps/normalizedast.html#[],T,BackwardsIndex proc `[]`[T: RecursiveNode](n: T; i: BackwardsIndex): T 388 +nim `[]` cps/normalizedast.html#[],R,HSlice[T,U] proc `[]`[R: RecursiveNode; T, U](n: R; x: HSlice[T, U]): seq[R] 391 +nim `[]=` cps/normalizedast.html#[]=,NormNode,int,NormNode proc `[]=`(n: NormNode; i: int; child: NormNode) 394 +nim `[]=` cps/normalizedast.html#[]=,NormNode,BackwardsIndex,NormNode proc `[]=`(n: NormNode; i: BackwardsIndex; child: NormNode) 396 +nim last cps/normalizedast.html#last,T proc last[T: RecursiveNode](n: T): T 399 +nim getPragmaName cps/normalizedast.html#getPragmaName,NimNode proc getPragmaName(n: NimNode): NimNode 403 +nim copyLineInfo cps/normalizedast.html#copyLineInfo,NormNode,NormNode proc copyLineInfo(arg, info: NormNode) 411 +nim copyLineInfo cps/normalizedast.html#copyLineInfo,NormNode,NimNode proc copyLineInfo(arg: NormNode; info: NimNode) 412 +nim items cps/normalizedast.html#items.i,NormNode iterator items(n: NormNode): NormNode 414 +nim pairs cps/normalizedast.html#pairs.i,NormNode iterator pairs(n: NormNode): (int, NormNode) 418 +nim newStmtList cps/normalizedast.html#newStmtList,AnyNodeVarargs proc newStmtList(stmts: AnyNodeVarargs): NormNode 423 +nim newTree cps/normalizedast.html#newTree,NimNodeKind,AnyNodeVarargs proc newTree(kind: NimNodeKind; n: AnyNodeVarargs): NormNode 429 +nim newNodeAndTransformIt cps/normalizedast.html#newNodeAndTransformIt.t,NimNode,untyped template newNodeAndTransformIt(n: NimNode; body: untyped): untyped 433 +nim copyNodeAndTransformIt cps/normalizedast.html#copyNodeAndTransformIt.t,NimNode,untyped template copyNodeAndTransformIt(n: NimNode; body: untyped): untyped 443 +nim wrap cps/normalizedast.html#wrap,NimNodeKind,NormNode proc wrap(kind: NimNodeKind; n: NormNode): NormNode 451 +nim seqNormalizedToSeqNimNode cps/normalizedast.html#seqNormalizedToSeqNimNode.c,seq[NormNode] converter seqNormalizedToSeqNimNode(n: seq[NormNode]): seq[NimNode] 455 +nim hash cps/normalizedast.html#hash.t,Name template hash(n: Name): Hash 462 +nim isNil cps/normalizedast.html#isNil,Name proc isNil(n: Name): bool 465 +nim `==` cps/normalizedast.html#==,Name,Name proc `==`(a, b: Name): bool 466 +nim `==` cps/normalizedast.html#==,NimNode,Name proc `==`(a: NimNode; b: Name): bool 467 +nim `$` cps/normalizedast.html#$,Name proc `$`(a: Name): string 468 +nim strVal cps/normalizedast.html#strVal,Name proc strVal(n: Name): string 469 +nim isSymbol cps/normalizedast.html#isSymbol,Name proc isSymbol(n: Name): bool 471 +nim asName cps/normalizedast.html#asName,NormNode proc asName(n`gensym51: NormNode): Name 477 +nim asNameAllowEmpty cps/normalizedast.html#asNameAllowEmpty,NormNode proc asNameAllowEmpty(n`gensym53: NormNode): Name 478 +nim asName cps/normalizedast.html#asName,NimNode proc asName(n: NimNode): Name 480 +nim asNameAllowEmpty cps/normalizedast.html#asNameAllowEmpty,NimNode proc asNameAllowEmpty(n: NimNode): Name 483 +nim asName cps/normalizedast.html#asName,string,NormNode proc asName(n: string; info: NormNode = NilNormNode): Name 498 +nim genSymType cps/normalizedast.html#genSymType,string,NormNode proc genSymType(n: string; info: NormNode = NilNormNode): Name 502 +nim genSymVar cps/normalizedast.html#genSymVar,string,NormNode proc genSymVar(n: string = ""; info: NormNode = NilNormNode): Name 505 +nim genSymLet cps/normalizedast.html#genSymLet,string,NormNode proc genSymLet(n: string = ""; info: NormNode = NilNormNode): Name 508 +nim genSymProc cps/normalizedast.html#genSymProc,string,NormNode proc genSymProc(n: string; info: NormNode = NilNormNode): Name 511 +nim genSymField cps/normalizedast.html#genSymField,string,NormNode proc genSymField(n: string; info: NormNode = NilNormNode): Name 514 +nim genSymUnknown cps/normalizedast.html#genSymUnknown,string,NormNode proc genSymUnknown(n: string; info: NormNode = NilNormNode): Name 517 +nim desym cps/normalizedast.html#desym,Name proc desym(n: Name): Name 521 +nim resym cps/normalizedast.html#resym,NormNode,Name,Name proc resym(fragment: NormNode; sym, replacement: Name): NormNode 523 +nim genField cps/normalizedast.html#genField,string proc genField(ident = ""): Name 526 +nim bindName cps/normalizedast.html#bindName,staticstring proc bindName(n: static string): Name 531 +nim bindName cps/normalizedast.html#bindName,staticstring,staticBindSymRule proc bindName(n: static string; rule: static BindSymRule): Name 535 +nim typeInst cps/normalizedast.html#typeInst,Name proc typeInst(n: Name): TypeExpr 540 +nim isExported cps/normalizedast.html#isExported,Name proc isExported(n: Name): bool 545 +nim eqIdent cps/normalizedast.html#eqIdent,,string proc eqIdent(a: Name | NimNode; b: string): bool 549 +nim eqIdent cps/normalizedast.html#eqIdent,, proc eqIdent(a: Name | NimNode; b: distinct Name | NimNode): bool 552 +nim eqIdent cps/normalizedast.html#eqIdent,NormNode,Name proc eqIdent(a: NormNode; b: Name): bool 555 +nim asName cps/normalizedast.html#asName,TypeExpr proc asName(n: TypeExpr): Name 557 +nim asSym cps/normalizedast.html#asSym,NormNode proc asSym(n`gensym62: NormNode): Sym 563 +nim cSymToName cps/normalizedast.html#cSymToName.c,Sym converter cSymToName(n`gensym64: Sym): Name 564 +nim typeInst cps/normalizedast.html#typeInst,Sym proc typeInst(n: Sym): TypeExpr 566 +nim ExprLike cps/normalizedast.html#ExprLike type ExprLike 572 +nim newDotExpr cps/normalizedast.html#newDotExpr,ExprLike, proc newDotExpr(l`gensym65: ExprLike; r`gensym65: distinct ExprLike): NormNode 582 +nim dot cps/normalizedast.html#dot.t,NormNode,NormNode template dot(a, b: NormNode): NormNode 586 +nim dot cps/normalizedast.html#dot.t,NormNode,string template dot(a: NormNode; b: string): NormNode 592 +nim newColonExpr cps/normalizedast.html#newColonExpr,ExprLike, proc newColonExpr(l`gensym66: ExprLike; r`gensym66: distinct ExprLike): NormNode 596 +nim newAssignment cps/normalizedast.html#newAssignment,ExprLike, proc newAssignment(l`gensym67: ExprLike; r`gensym67: distinct ExprLike): NormNode 600 +nim newCall cps/normalizedast.html#newCall,NormNode,AnyNodeVarargs proc newCall(n: NormNode; args: AnyNodeVarargs): Call 603 +nim newCall cps/normalizedast.html#newCall,Name,AnyNodeVarargs proc newCall(n: Name; args: AnyNodeVarargs): Call 606 +nim newCall cps/normalizedast.html#newCall,string,AnyNodeVarargs proc newCall(n: string; args: AnyNodeVarargs): Call 609 +nim asTypeSection cps/normalizedast.html#asTypeSection,NormNode proc asTypeSection(n`gensym68: NormNode): TypeSection 614 +nim asTypeDef cps/normalizedast.html#asTypeDef,NormNode proc asTypeDef(n`gensym70: NormNode): TypeDef 617 +nim asTypeExpr cps/normalizedast.html#asTypeExpr,NormNode proc asTypeExpr(n`gensym72: NormNode): TypeExpr 621 +nim asTypeExprAllowEmpty cps/normalizedast.html#asTypeExprAllowEmpty,NormNode proc asTypeExprAllowEmpty(n`gensym74: NormNode): TypeExpr 622 +nim isNil cps/normalizedast.html#isNil,TypeExpr proc isNil(n: TypeExpr): bool 625 +nim `==` cps/normalizedast.html#==,TypeExpr,TypeExpr proc `==`(a, b: TypeExpr): bool 628 +nim typeKind cps/normalizedast.html#typeKind,TypeExpr proc typeKind(n: TypeExpr): NimTypeKind 631 +nim sameType cps/normalizedast.html#sameType,TypeExpr,TypeExpr proc sameType(a, b: TypeExpr): bool 634 +nim asTypeExprObj cps/normalizedast.html#asTypeExprObj,NormNode proc asTypeExprObj(n`gensym76: NormNode): TypeExprObj 639 +nim asTypeExprRef cps/normalizedast.html#asTypeExprRef,NormNode proc asTypeExprRef(n`gensym78: NormNode): TypeExprRef 643 +nim newRefType cps/normalizedast.html#newRefType,Name proc newRefType(n: Name): TypeExprRef 645 +nim sinkAnnotated cps/normalizedast.html#sinkAnnotated,NormNode proc sinkAnnotated(n: NormNode): TypeExpr 649 +nim asPragmaAtom cps/normalizedast.html#asPragmaAtom,Name proc asPragmaAtom(n: Name): PragmaAtom 655 +nim newPragmaColonExpr cps/normalizedast.html#newPragmaColonExpr,static[string],NormNode proc newPragmaColonExpr(n: static[string]; r: NormNode): PragmaAtom 659 +nim getPragmaName cps/normalizedast.html#getPragmaName,PragmaAtom proc getPragmaName(n: PragmaAtom): Name 663 +nim PragmaLike cps/normalizedast.html#PragmaLike type PragmaLike 675 +nim items cps/normalizedast.html#items.i,PragmaLike iterator items(n: PragmaLike): PragmaAtom 683 +nim hasPragma cps/normalizedast.html#hasPragma,PragmaLike,static[string] proc hasPragma(n: PragmaLike; s: static[string]): bool 694 +nim IdentDefLike cps/normalizedast.html#IdentDefLike type IdentDefLike 704 +nim name cps/normalizedast.html#name,PragmaExpr proc name(n: PragmaExpr): Name 708 +nim name cps/normalizedast.html#name,IdentDefLike proc name(n: IdentDefLike): Name 712 +nim DefLike cps/normalizedast.html#DefLike type DefLike 723 +nim typ cps/normalizedast.html#typ,DefLike proc typ(n: DefLike): TypeExpr 726 +nim val cps/normalizedast.html#val,DefLike proc val(n: DefLike): NormNode 730 +nim hasValue cps/normalizedast.html#hasValue,DefLike proc hasValue(n: DefLike): bool 733 +nim hasType cps/normalizedast.html#hasType,DefLike proc hasType(n: DefLike): bool 738 +nim inferTypFromImpl cps/normalizedast.html#inferTypFromImpl,DefLike proc inferTypFromImpl(n: DefLike): TypeExpr 742 +nim asIdentDefs cps/normalizedast.html#asIdentDefs,NimNode proc asIdentDefs(n: NimNode): IdentDef 757 +nim newIdentDef cps/normalizedast.html#newIdentDef,Name,TypeExprLike proc newIdentDef(n: Name; t: TypeExprLike; val = newEmptyNode()): IdentDef 762 +nim newIdentDef cps/normalizedast.html#newIdentDef,string,TypeExprLike proc newIdentDef(n: string; t: TypeExprLike; val = newEmptyNode()): IdentDef 767 +nim newIdentDef cps/normalizedast.html#newIdentDef,Name,NormNode proc newIdentDef(n: Name; val: NormNode): IdentDef 771 +nim LetSectionLike cps/normalizedast.html#LetSectionLike type LetSectionLike 781 +nim VarSectionLike cps/normalizedast.html#VarSectionLike type VarSectionLike 784 +nim VarLetLike cps/normalizedast.html#VarLetLike type VarLetLike 790 +nim def cps/normalizedast.html#def,VarLetLike proc def(n: VarLetLike): DefVarLet | TupleDefVarLet 794 +nim val cps/normalizedast.html#val,VarLetLike proc val(n: VarLetLike): NormNode 802 +nim typ cps/normalizedast.html#typ,VarLetLike proc typ(n: VarLetLike): TypeExpr 806 +nim kind cps/normalizedast.html#kind,VarLetLike proc kind(n: VarLetLike): NimNodeKind 813 +nim hasValue cps/normalizedast.html#hasValue,VarLetLike proc hasValue(n: VarLetLike): bool 814 +nim isTuple cps/normalizedast.html#isTuple,VarLetLike proc isTuple(n: VarLetLike): bool 818 +nim VarLetIdentDefLike cps/normalizedast.html#VarLetIdentDefLike type VarLetIdentDefLike 823 +nim identdef cps/normalizedast.html#identdef,VarLetIdentDef proc identdef(n: VarLetIdentDefLike): IdentDef 826 +nim name cps/normalizedast.html#name,VarLetIdentDef proc name(n: VarLetIdentDefLike): Name 828 +nim inferTypFromImpl cps/normalizedast.html#inferTypFromImpl,VarLetIdentDef proc inferTypFromImpl(n: VarLetIdentDefLike): TypeExpr 831 +nim asVarLet cps/normalizedast.html#asVarLet,NimNode proc asVarLet(n: NimNode): VarLet 869 +nim asVarLetTuple cps/normalizedast.html#asVarLetTuple,VarLet proc asVarLetTuple(n: VarLet): VarLetTuple 876 +nim asVarLetIdentDef cps/normalizedast.html#asVarLetIdentDef,VarLet proc asVarLetIdentDef(n: VarLet): VarLetIdentDef 879 +nim smartSniffer cps/normalizedast.html#smartSniffer,VarLetLike proc smartSniffer(n: VarLetLike): TypeExpr 883 +nim clone cps/normalizedast.html#clone,VarLet,NimNode proc clone(n: VarLet; value: NimNode = NilNimNode): VarLet 891 +nim indexNamePairs cps/normalizedast.html#indexNamePairs.i,VarLetTuple iterator indexNamePairs(n: VarLetTuple): (int, Name) 916 +nim newVarLetIdentDef cps/normalizedast.html#newVarLetIdentDef,NimNodeKind,IdentDef proc newVarLetIdentDef(kind: NimNodeKind; i: IdentDef): VarLetIdentDef 927 +nim newVarLetIdentDef cps/normalizedast.html#newVarLetIdentDef,NimNodeKind,Name,TypeExprLike,NimNode proc newVarLetIdentDef(kind: NimNodeKind; name: Name; typ: TypeExprLike; val: NimNode): VarLetIdentDef 932 +nim newVarIdentDef cps/normalizedast.html#newVarIdentDef,IdentDef proc newVarIdentDef(i: IdentDef): VarIdentDef 939 +nim newVarSection cps/normalizedast.html#newVarSection,IdentDef proc newVarSection(i: IdentDef): VarSection 946 +nim newVarSection cps/normalizedast.html#newVarSection,Name,TypeExprLike proc newVarSection(n: Name; t: TypeExprLike; val = newEmptyNode()): VarSection 950 +nim newLetIdentDef cps/normalizedast.html#newLetIdentDef,IdentDef proc newLetIdentDef(i: IdentDef): LetIdentDef 956 +nim newLetIdentDef cps/normalizedast.html#newLetIdentDef,Name,NormNode proc newLetIdentDef(n: Name; val: NormNode): LetIdentDef 960 +nim newLetIdentDef cps/normalizedast.html#newLetIdentDef,Name,TypeExprLike proc newLetIdentDef(n: Name; t: TypeExprLike; val = newEmptyNode()): LetIdentDef 962 +nim newIdentDefVar cps/normalizedast.html#newIdentDefVar,IdentDef proc newIdentDefVar(i: IdentDef): IdentDefVar 968 +nim newIdentDefVar cps/normalizedast.html#newIdentDefVar,Name,TypeExprLike proc newIdentDefVar(n: Name; t: TypeExprLike; val = newEmptyNode()): IdentDefVar 972 +nim asPragmaStmt cps/normalizedast.html#asPragmaStmt,NormNode proc asPragmaStmt(n`gensym101: NormNode): PragmaStmt 978 +nim asPragmaStmt cps/normalizedast.html#asPragmaStmt,Name proc asPragmaStmt(n: Name): PragmaStmt 979 +nim newPragmaStmt cps/normalizedast.html#newPragmaStmt,varargs[PragmaAtom] proc newPragmaStmt(es: varargs[PragmaAtom]): PragmaStmt 983 +nim newPragmaStmt cps/normalizedast.html#newPragmaStmt,Name proc newPragmaStmt(n: Name): PragmaStmt 993 +nim newPragmaStmtWithInfo cps/normalizedast.html#newPragmaStmtWithInfo,NormNode,varargs[PragmaAtom] proc newPragmaStmtWithInfo(inf: NormNode; es: varargs[PragmaAtom]): PragmaStmt 998 +nim asPragmaBlock cps/normalizedast.html#asPragmaBlock,NormNode proc asPragmaBlock(n`gensym103: NormNode): PragmaBlock 1006 +nim PragmaHaver cps/normalizedast.html#PragmaHaver type PragmaHaver 1011 +nim pragma cps/normalizedast.html#pragma,PragmaHaver proc pragma(n: PragmaHaver): PragmaLike 1015 +nim hasPragma cps/normalizedast.html#hasPragma,PragmaHaver,static[string] proc hasPragma(n: PragmaHaver; s: static[string]): bool 1031 +nim RoutineDefLike cps/normalizedast.html#RoutineDefLike type RoutineDefLike 1038 +nim addPragma cps/normalizedast.html#addPragma,RoutineDefLike,Name proc addPragma(n: RoutineDefLike; prag: Name) 1040 +nim addPragma cps/normalizedast.html#addPragma,RoutineDefLike,string proc addPragma(n: RoutineDefLike; prag: string) 1044 +nim addPragma cps/normalizedast.html#addPragma,RoutineDefLike,Name,NimNode proc addPragma(n: RoutineDefLike; prag: Name; pragArg: NimNode) 1049 +nim addPragma cps/normalizedast.html#addPragma,RoutineDefLike,Name,Name proc addPragma(n: RoutineDefLike; prag: Name; pragArg: Name) 1054 +nim addPragma cps/normalizedast.html#addPragma,RoutineDefLike,Name,openArray[Name] proc addPragma(n: RoutineDefLike; prag: Name; pragArgs: openArray[Name]) 1058 +nim asCallKind cps/normalizedast.html#asCallKind,NormNode proc asCallKind(n`gensym105: NormNode): CallKind 1064 +nim asCall cps/normalizedast.html#asCall,NormNode proc asCall(n`gensym107: NormNode): Call 1065 +nim ifCallThenIt cps/normalizedast.html#ifCallThenIt.t,NormNode,untyped template ifCallThenIt(n: NormNode; body: untyped) 1067 +nim ifCallKindThenIt cps/normalizedast.html#ifCallKindThenIt.t,NormNode,untyped template ifCallKindThenIt(n: NormNode; body: untyped) 1073 +nim name cps/normalizedast.html#name,Call proc name(n: Call): Name 1079 +nim name= cps/normalizedast.html#name=,Call,Name proc name=(callee: Call; newName: Name) 1083 +nim prependArg cps/normalizedast.html#prependArg,Call,NormNode proc prependArg(n: Call; arg: NormNode) 1087 +nim hasImpl cps/normalizedast.html#hasImpl,Call proc hasImpl(n: Call): bool 1091 +nim impl cps/normalizedast.html#impl,Call proc impl(n: Call): RoutineDef 1095 +nim childCallToRecoverResult cps/normalizedast.html#childCallToRecoverResult,Call,NormNode,NormNode proc childCallToRecoverResult(n: Call; sym, field: NormNode): Call 1102 +nim desym cps/normalizedast.html#desym,Call proc desym(n: Call) 1107 +nim asConv cps/normalizedast.html#asConv,NormNode proc asConv(n`gensym110: NormNode): Conv 1113 +nim typ cps/normalizedast.html#typ,Conv proc typ(n: Conv): TypeExpr 1115 +nim expr cps/normalizedast.html#expr,Conv proc expr(n: Conv): NormNode 1119 +nim newFormalParams cps/normalizedast.html#newFormalParams,TypeExpr,varargs[IdentDef] proc newFormalParams(ret: TypeExpr; ps: varargs[IdentDef]): FormalParams 1125 +nim asRoutineDef cps/normalizedast.html#asRoutineDef,NormNode proc asRoutineDef(n`gensym112: NormNode): RoutineDef 1133 +nim name cps/normalizedast.html#name,RoutineDef proc name(n: RoutineDef): Name 1136 +nim name= cps/normalizedast.html#name=,RoutineDef,Name proc name=(n: RoutineDef; name: Name) 1139 +nim body cps/normalizedast.html#body,RoutineDef proc body(n: RoutineDef): NormNode 1143 +nim body= cps/normalizedast.html#body=,RoutineDef,NormNode proc body=(n: RoutineDef; b: NormNode) 1145 +nim formalParams cps/normalizedast.html#formalParams,RoutineDef proc formalParams(n: RoutineDef): FormalParams 1148 +nim formalParams= cps/normalizedast.html#formalParams=,RoutineDef,FormalParams proc formalParams=(n: RoutineDef; f: FormalParams) 1152 +nim firstCallParam cps/normalizedast.html#firstCallParam,RoutineDef proc firstCallParam(n: RoutineDef): RoutineParam 1156 +nim pragma= cps/normalizedast.html#pragma=,RoutineDef,PragmaStmt proc pragma=(n: RoutineDef; p: PragmaStmt) 1163 +nim newProcDef cps/normalizedast.html#newProcDef,Name,TypeExpr,varargs[IdentDef] proc newProcDef(name: Name; retType: TypeExpr; callParams: varargs[IdentDef]): ProcDef 1169 +nim asProcDef cps/normalizedast.html#asProcDef,NormNode proc asProcDef(n`gensym114: NormNode): ProcDef 1177 +nim pragma= cps/normalizedast.html#pragma=,ProcDef,PragmaStmt proc pragma=(n: ProcDef; p: PragmaStmt) 1179 +nim returnParam cps/normalizedast.html#returnParam,ProcDef proc returnParam(n: ProcDef): TypeExpr 1183 +nim returnParam= cps/normalizedast.html#returnParam=,ProcDef,Name proc returnParam=(n: ProcDef; ret: Name) 1187 +nim callingParams cps/normalizedast.html#callingParams.i,ProcDef iterator callingParams(n: ProcDef): RoutineParam 1191 +nim clone cps/normalizedast.html#clone,ProcDef,NimNode proc clone(n: ProcDef; body: NimNode = NilNimNode): ProcDef 1197 +nim hasPragma cps/normalizedast.html#hasPragma,NormNode,static[string] proc hasPragma(n: NormNode; s: static[string]): bool 1210 +nim genProcName cps/normalizedast.html#genProcName,string proc genProcName(a: string; info = NilNormNode): Name 1228 +nim genProcName cps/normalizedast.html#genProcName,string,string proc genProcName(a, b: string; info = NilNormNode): Name 1231 +nim genTypeName cps/normalizedast.html#genTypeName,string,string proc genTypeName(a, b: string; info = NilNormNode): Name 1234 +nim postfix cps/normalizedast.html#postfix,Name,string proc postfix(n: Name; op: string): Name 1237 +nimgrp genprocname cps/normalizedast.html#genProcName-procs-all proc 1228 +nimgrp asname cps/normalizedast.html#asName-procs-all proc 284 +nimgrp addpragma cps/normalizedast.html#addPragma-procs-all proc 1040 +nimgrp newcall cps/normalizedast.html#newCall-procs-all proc 603 +nimgrp typ cps/normalizedast.html#typ-procs-all proc 726 +nimgrp add cps/normalizedast.html#add-procs-all proc 347 +nimgrp haspragma cps/normalizedast.html#hasPragma-procs-all proc 694 +nimgrp newpragmastmt cps/normalizedast.html#newPragmaStmt-procs-all proc 983 +nimgrp eqident cps/normalizedast.html#eqIdent-procs-all proc 549 +nimgrp asnameallowempty cps/normalizedast.html#asNameAllowEmpty-procs-all proc 294 +nimgrp []= cps/normalizedast.html#[]=-procs-all proc 394 +nimgrp desym cps/normalizedast.html#desym-procs-all proc 327 +nimgrp newidentdef cps/normalizedast.html#newIdentDef-procs-all proc 762 +nimgrp kind cps/normalizedast.html#kind-procs-all proc 344 +nimgrp [] cps/normalizedast.html#[]-procs-all proc 385 +nimgrp $ cps/normalizedast.html#$-procs-all proc 337 +nimgrp newletidentdef cps/normalizedast.html#newLetIdentDef-procs-all proc 956 +nimgrp newidentdefvar cps/normalizedast.html#newIdentDefVar-procs-all proc 968 +nimgrp newvarletidentdef cps/normalizedast.html#newVarLetIdentDef-procs-all proc 927 +nimgrp copylineinfo cps/normalizedast.html#copyLineInfo-procs-all proc 411 +nimgrp typeinst cps/normalizedast.html#typeInst-procs-all proc 540 +nimgrp clone cps/normalizedast.html#clone-procs-all proc 891 +nimgrp infertypfromimpl cps/normalizedast.html#inferTypFromImpl-procs-all proc 742 +nimgrp isnil cps/normalizedast.html#isNil-procs-all proc 465 +nimgrp hasvalue cps/normalizedast.html#hasValue-procs-all proc 733 +nimgrp val cps/normalizedast.html#val-procs-all proc 730 +nimgrp aspragmastmt cps/normalizedast.html#asPragmaStmt-procs-all proc 284 +nimgrp pragma= cps/normalizedast.html#pragma=-procs-all proc 1163 +nimgrp name= cps/normalizedast.html#name=-procs-all proc 1083 +nimgrp bindname cps/normalizedast.html#bindName-procs-all proc 531 +nimgrp name cps/normalizedast.html#name-procs-all proc 708 +nimgrp getpragmaname cps/normalizedast.html#getPragmaName-procs-all proc 403 +nimgrp newvarsection cps/normalizedast.html#newVarSection-procs-all proc 946 +nimgrp == cps/normalizedast.html#==-procs-all proc 466 +nimgrp items cps/normalizedast.html#items-iterators-all iterator 414 +nimgrp dot cps/normalizedast.html#dot-templates-all template 586 +nimgrp hash cps/normalizedast.html#hash-templates-all template 333 diff --git a/cps/returns.html b/cps/returns.html new file mode 100644 index 00000000..b722caf0 --- /dev/null +++ b/cps/returns.html @@ -0,0 +1,263 @@ + + + + + + + +cps/returns + + + + + + + + + + + + +
+
+

cps/returns

+
+ +
+ Source   +Edit   + +
+ +

+ +
+

Procs

+
+
+
+
proc dismiss() {.used, cpsMustJump, cpsMagicCall, ...raises: [], tags: [],
+                 forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc dismiss(continuation: sink Continuation): Continuation {.used, ...raises: [],
+    tags: [], forbids: [].}
+
+ + A convenience which simply discards the continuation. + Source   +Edit   + +
+
+ +
+
+
+
proc firstReturn(p: NormNode): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + Find the first control-flow return statement or cps control-flow within statement lists; else, nil. + Source   +Edit   + +
+
+ +
+
+
+
proc jumperCall(cont, contType, to: Name; via: NormNode): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + Produce a tail call to to with cont as the continuation The via argument is expected to be a cps jumper call. + Source   +Edit   + +
+
+ +
+
+
+
proc makeReturn(contType: Name; n: NormNode): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + generate a return of the node if it doesn't already contain a return + Source   +Edit   + +
+
+
+
proc makeReturn(contType: Name; pre, n: NormNode): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + if pre holds no return, produce a return of n after pre + Source   +Edit   + +
+
+ +
+
+
+
proc tailCall(cont, contType, to: Name; jump: NormNode = NilNormNode): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + a tail call to to with cont as the continuation; if the jump is supplied, return that call instead of the continuation itself + Source   +Edit   + +
+
+ +
+
+
+
proc terminator(c: Name; contType: Name; tipe: NormNode): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + produce the terminating return statement of the continuation; this should return control to the mom and dealloc the continuation, or simply set the fn to nil and return the continuation. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template pass(source: Continuation; destination: Continuation): Continuation {.
+    used.}
+
+ + This symbol may be reimplemented to introduce logic during the transfer of control between parent and child continuations. The return value specifies the destination continuation. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/returns.idx b/cps/returns.idx new file mode 100644 index 00000000..e5d6af58 --- /dev/null +++ b/cps/returns.idx @@ -0,0 +1,12 @@ +nimTitle returns cps/returns.html module cps/returns 0 +nim firstReturn cps/returns.html#firstReturn,NormNode proc firstReturn(p: NormNode): NormNode 5 +nim makeReturn cps/returns.html#makeReturn,Name,NormNode proc makeReturn(contType: Name; n: NormNode): NormNode 23 +nim makeReturn cps/returns.html#makeReturn,Name,NormNode,NormNode proc makeReturn(contType: Name; pre, n: NormNode): NormNode 37 +nim pass cps/returns.html#pass.t,Continuation,Continuation template pass(source: Continuation; destination: Continuation): Continuation 51 +nim dismiss cps/returns.html#dismiss,sinkContinuation proc dismiss(continuation: sink Continuation): Continuation 57 +nim dismiss cps/returns.html#dismiss proc dismiss() 57 +nim terminator cps/returns.html#terminator,Name,Name,NormNode proc terminator(c: Name; contType: Name; tipe: NormNode): NormNode 61 +nim tailCall cps/returns.html#tailCall,Name,Name,Name,NormNode proc tailCall(cont, contType, to: Name; jump: NormNode = NilNormNode): NormNode 90 +nim jumperCall cps/returns.html#jumperCall,Name,Name,Name,NormNode proc jumperCall(cont, contType, to: Name; via: NormNode): NormNode 103 +nimgrp dismiss cps/returns.html#dismiss-procs-all proc 57 +nimgrp makereturn cps/returns.html#makeReturn-procs-all proc 23 diff --git a/cps/rewrites.html b/cps/rewrites.html new file mode 100644 index 00000000..8bd54e2d --- /dev/null +++ b/cps/rewrites.html @@ -0,0 +1,548 @@ + + + + + + + +cps/rewrites + + + + + + + + + + + + +
+
+

cps/rewrites

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+
+

Types

+
+
+
Matcher = proc (n: NimNode): bool
+
+ + A proc that returns whether a NimNode should be replaced + Source   +Edit   + +
+
+
+
NodeFilter = proc (n: NimNode): NimNode
+
+ + + Source   +Edit   + +
+
+
+
NormalizingFilter = proc (n: NimNode): NormNode
+
+ + variant of NodeFilter but normalizes the node + Source   +Edit   + +
+
+
+
NormFilter = proc (n: NormNode): NormNode
+
+ + variant of NodeFilter but normalizes the node + Source   +Edit   + +
+
+
+
NormMatcher = proc (n: NormNode): bool {.noSideEffect.}
+
+ + A proc that returns whether a NimNode should be replaced + Source   +Edit   + +
+
+
+
NormNode = distinct NimNode
+
+ + a normalized node, but this should not be useed directly, use a specialized type instead, see the normalizedast module. + Source   +Edit   + +
+
+ +
+
+
+

Consts

+
+
+
NormalCallNodes = {nnkCommand..nnkPostfix}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc addInitializationToDefault(n: NimNode): NimNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + Turn an IdentDefs as in var x: Foo into var x: Foo = default Foo; this ensures a reset of the field in the environment occurs when the scope is re-entrant for any reason. + Source   +Edit   + +
+
+ +
+
+
+
proc childCallToRecoverResult(n, sym, field: NormNode): NormNode {.borrow,
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + this is used to rewrite continuation calls into their results + Source   +Edit   + +
+
+
+
proc childCallToRecoverResult(n: NimNode; sym: NimNode; field: NimNode): NimNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + this is used to rewrite continuation calls into their results + Source   +Edit   + +
+
+ +
+
+
+
proc desym(n: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc errorAst(n: NimNode | NormNode; s = "creepy ast"): NormNode
+
+ + embed an error with a message, the line info is copied from the node + Source   +Edit   + +
+
+
+
proc errorAst(s: string; info: NimNode = nil): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ +

produce {.error: s.} in order to embed errors in the ast

+

optionally take a node to set the error line information

+ + Source   +Edit   + +
+
+ +
+
+
+
proc filter(n: NimNode; f: NodeFilter): NimNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + rewrites a node and its children by passing each node to the filter; if the filter yields nil, the node is simply copied. otherwise, the node is replaced. + Source   +Edit   + +
+
+
+
proc filter(n: NimNode; f: NormalizingFilter): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + rewrites a node and its children by passing each node to the filter; if the filter yields nil, the node is simply copied. otherwise, the node is replaced. + Source   +Edit   + +
+
+
+
proc filter(n: NormNode; f: NormFilter): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + rewrites a node and its children by passing each node to the filter; if the filter yields nil, the node is simply copied. otherwise, the node is replaced. + Source   +Edit   + +
+
+ +
+
+
+
func isEmpty(n: NimNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + true if the node n is Empty + Source   +Edit   + +
+
+ +
+
+
+
proc multiReplace(n: NimNode; replacements: varargs[(Matcher, NimNode)]): NimNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + Replace any node in n that is matched by a matcher in replacements with a copy of the accompanying NimNode. + Source   +Edit   + +
+
+
+
proc multiReplace(n: NormNode; replacements: varargs[(Matcher, NormNode)]): NormNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + Replace any node in n that is matched by a matcher in replacements with a copy of the accompanying NimNode. + Source   +Edit   + +
+
+
+
proc multiReplace(n: NormNode; replacements: varargs[(NormMatcher, NormNode)]): NormNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + Replace any node in n that is matched by a matcher in replacements with a copy of the accompanying NimNode. + Source   +Edit   + +
+
+ +
+
+
+
proc normalizingRewrites(n: NimNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + Rewrite AST into a safe form for manipulation without removing semantic data. + Source   +Edit   + +
+
+ +
+
+
+
proc replace(n: NimNode | NormNode; match: NormMatcher; replacement: NormNode): NormNode
+
+ + Replace any node in n that is matched by match with a copy of replacement + Source   +Edit   + +
+
+
+
proc replace(n: NimNode; match: Matcher; replacement: NimNode): NimNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + Replace any node in n that is matched by match with a copy of replacement + Source   +Edit   + +
+
+ +
+
+
+
proc replacedSymsWithIdents(n: NimNode): NimNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc resym(n, sym, field: NormNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc resym(n: NimNode; sym: NimNode; field: NimNode): NimNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + seems we only use this for rewriting local symbols into symbols in the env, so we'll do custom handling of identDefs here also + Source   +Edit   + +
+
+ +
+
+
+
proc workaroundRewrites(n: NormNode): NormNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template replace(n, noob: NimNode; body: untyped): NimNode {.dirty.}
+
+ + requires --define:nimWorkaround14447 so... yeah. + Source   +Edit   + +
+
+
+
template replace(n, noob: NormNode; body: untyped): NormNode {.dirty.}
+
+ + requires --define:nimWorkaround14447 so... yeah. + Source   +Edit   + +
+
+ +
+ +
+
+ +
+
+ + +
+
+ + + + + + diff --git a/cps/rewrites.idx b/cps/rewrites.idx new file mode 100644 index 00000000..912d48a7 --- /dev/null +++ b/cps/rewrites.idx @@ -0,0 +1,37 @@ +nimTitle rewrites cps/rewrites.html module cps/rewrites 0 +nim NodeFilter cps/rewrites.html#NodeFilter type NodeFilter 4 +nim NormalizingFilter cps/rewrites.html#NormalizingFilter type NormalizingFilter 5 +nim NormFilter cps/rewrites.html#NormFilter type NormFilter 7 +nim Matcher cps/rewrites.html#Matcher type Matcher 9 +nim NormMatcher cps/rewrites.html#NormMatcher type NormMatcher 11 +nim NormNode cps/rewrites.html#NormNode type NormNode 13 +nim NormalCallNodes cps/rewrites.html#NormalCallNodes const NormalCallNodes 17 +nim filter cps/rewrites.html#filter,NimNode,NodeFilter proc filter(n: NimNode; f: NodeFilter): NimNode 24 +nim filter cps/rewrites.html#filter,NimNode,NormalizingFilter proc filter(n: NimNode; f: NormalizingFilter): NormNode 34 +nim filter cps/rewrites.html#filter,NormNode,NormFilter proc filter(n: NormNode; f: NormFilter): NormNode 40 +nim isEmpty cps/rewrites.html#isEmpty,NimNode proc isEmpty(n: NimNode): bool 46 +nim errorAst cps/rewrites.html#errorAst,string,NimNode proc errorAst(s: string; info: NimNode = nil): NormNode 50 +nim errorAst cps/rewrites.html#errorAst,,string proc errorAst(n: NimNode | NormNode; s = "creepy ast"): NormNode 60 +nim desym cps/rewrites.html#desym,NimNode proc desym(n: NimNode): NimNode 65 +nim childCallToRecoverResult cps/rewrites.html#childCallToRecoverResult,NimNode,NimNode,NimNode proc childCallToRecoverResult(n: NimNode; sym: NimNode; field: NimNode): NimNode 71 +nim childCallToRecoverResult cps/rewrites.html#childCallToRecoverResult,NormNode,NormNode,NormNode proc childCallToRecoverResult(n, sym, field: NormNode): NormNode 84 +nim resym cps/rewrites.html#resym,NimNode,NimNode,NimNode proc resym(n: NimNode; sym: NimNode; field: NimNode): NimNode 87 +nim resym cps/rewrites.html#resym,NormNode,NormNode,NormNode proc resym(n, sym, field: NormNode): NormNode 105 +nim replacedSymsWithIdents cps/rewrites.html#replacedSymsWithIdents,NimNode proc replacedSymsWithIdents(n: NimNode): NimNode 108 +nim normalizingRewrites cps/rewrites.html#normalizingRewrites,NimNode proc normalizingRewrites(n: NimNode): NormNode 117 +nim workaroundRewrites cps/rewrites.html#workaroundRewrites,NormNode proc workaroundRewrites(n: NormNode): NormNode 443 +nim replace cps/rewrites.html#replace,NimNode,Matcher,NimNode proc replace(n: NimNode; match: Matcher; replacement: NimNode): NimNode 446 +nim replace cps/rewrites.html#replace,,NormMatcher,NormNode proc replace(n: NimNode | NormNode; match: NormMatcher; replacement: NormNode): NormNode 457 +nim replace cps/rewrites.html#replace.t,NimNode,NimNode,untyped template replace(n, noob: NimNode; body: untyped): NimNode 466 +nim replace cps/rewrites.html#replace.t,NormNode,NormNode,untyped template replace(n, noob: NormNode; body: untyped): NormNode 471 +nim multiReplace cps/rewrites.html#multiReplace,NimNode,varargs[] proc multiReplace(n: NimNode; replacements: varargs[(Matcher, NimNode)]): NimNode 476 +nim multiReplace cps/rewrites.html#multiReplace,NormNode,varargs[] proc multiReplace(n: NormNode; replacements: varargs[(Matcher, NormNode)]): NormNode 491 +nim multiReplace cps/rewrites.html#multiReplace,NormNode,varargs[]_2 proc multiReplace(n: NormNode; replacements: varargs[(NormMatcher, NormNode)]): NormNode 506 +nim addInitializationToDefault cps/rewrites.html#addInitializationToDefault,NimNode proc addInitializationToDefault(n: NimNode): NimNode 521 +nimgrp replace cps/rewrites.html#replace-procs-all proc 446 +nimgrp filter cps/rewrites.html#filter-procs-all proc 24 +nimgrp childcalltorecoverresult cps/rewrites.html#childCallToRecoverResult-procs-all proc 71 +nimgrp errorast cps/rewrites.html#errorAst-procs-all proc 50 +nimgrp multireplace cps/rewrites.html#multiReplace-procs-all proc 476 +nimgrp resym cps/rewrites.html#resym-procs-all proc 87 +nimgrp replace cps/rewrites.html#replace-templates-all template 466 diff --git a/cps/spec.html b/cps/spec.html new file mode 100644 index 00000000..cc90f85d --- /dev/null +++ b/cps/spec.html @@ -0,0 +1,1572 @@ + + + + + + + +cps/spec + + + + + + + + + + + + +
+
+

cps/spec

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

boring utilities likely useful to multiple pieces of cps machinery

+ +
+

Types

+
+
+
Callback[C; R; P] = object
+  fn*: P                     ## 
+                             ## the bootstrap for continuation C
+  rs*: proc (c: var C): R {.nimcall.} ## 
+                                      ## the result fetcher for continuation C
+  
+
+ + + Source   +Edit   + +
+
+
+
Continuation = ref object of ContinuationObj
+
+ + + Source   +Edit   + +
+
+
+
ContinuationObj = object of RootObj
+  fn*: proc (c: sink Continuation): Continuation {.nimcall.} ## 
+                                                             ## The `fn` points to the next continuation leg.
+  mom*: Continuation ## 
+                     ## If this Continuation was invoked by another Continuation,
+                     ## the `mom` will hold that parent Continuation to form a
+                     ## linked-list approximating a stack.
+  ex*: ref Exception         ## The unhandled exception of the continuation.
+  when cpsTraceDeque:
+      frames*: Deque[TraceFrame] ## Tracing for all prior hooks
+    
+  when cpsStackFrames:
+      stack*: TraceFrame     ## Stack-like semantic record
+    
+  
+
+ + + Source   +Edit   + +
+
+
+
ContinuationProc[T] = proc (c: sink T): T {.nimcall.}
+
+ + + Source   +Edit   + +
+
+
+
Hook = enum
+  Coop = "coop",            ## returns control to the dispatcher
+  Trace = "trace",          ## executed at entry to each continuation leg
+  Alloc = "alloc",          ## performs allocation of a new continuation
+  Dealloc = "dealloc",      ## performs deallocation of a continuation
+  Pass = "pass",            ## transfers control-flow between continuations
+  Boot = "boot",            ## prepares a continuation for initial use
+  Unwind = "unwind",        ## controlled "bubble-up" for exception handling
+  Head = "head",            ## invoked when a new continuation has no parent
+  Tail = "tail",            ## invoked when a new continuation has a parent
+  Stack = "stack"            ## invoked to annotate stack semantics
+
+ + these are hook procedure names; the string value matches the name of the symbol we'll call to perform the hook. + Source   +Edit   + +
+
+
+
State {.pure.} = enum
+  Running,                  ## The continuation is active and running and can be resumed
+  Dismissed,                ## The continuation is currently somewhere else
+  Finished                   ## The continuation is finished and can no longer be resumed
+
+ + Representation of the state of a continuation. + Source   +Edit   + +
+
+
+
TraceFrame = object
+  hook*: Hook                ## the hook that provoked the trace entry
+  fun*: string               ## a short label for the notable symbol
+  info*: LineInfo            ## the source of the notable symbol
+  
+
+ + a record of where the continuation has been + Source   +Edit   + +
+
+ +
+
+
+

Consts

+
+
+
cpsCallOperatorSupported = true
+
+ + + Source   +Edit   + +
+
+
+
cpsStackFrames {.booldefine, used.} = true
+
+ + + Source   +Edit   + +
+
+
+
cpsTraceDeque {.booldefine, used.} = true
+
+ + + Source   +Edit   + +
+
+
+
traceDequeSize {.intdefine, used.} = 4096
+
+ + + Source   +Edit   + +
+
+ +
+
+
+

Procs

+
+
+
+
proc bootstrapSymbol(n: NimNode): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + find the return type of the bootstrap + Source   +Edit   + +
+
+ +
+
+
+
proc breakLabel(n: NormNode): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + Return the break label of a break statement or a cpsBreak annotation + Source   +Edit   + +
+
+ +
+
+
+
proc copyOrVoid(n: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + if the node is empty, ident"void"; else, a copy of the node + Source   +Edit   + +
+
+ +
+
+
+
proc cpsCallbackTypeDef(tipe: NimNode; n: NimNode): NimNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + looks like cpsTransformProc but applies to proc typedefs; this is where we create our calling convention concept + Source   +Edit   + +
+
+ +
+
+
+
proc createCallback(sym: NimNode): NimNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + create a new Callback object construction + Source   +Edit   + +
+
+ +
+
+
+
proc emptyAsNil(n: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + normalize nil, nnkEmpty to nnkNilLit + Source   +Edit   + +
+
+ +
+
+
+
proc enbasen(n: NimNode): TypeExpr {....raises: [], tags: [], forbids: [].}
+
+ + find the parent type of the given symbol/type + Source   +Edit   + +
+
+ +
+
+
+
proc ensimilate(source, destination: NormNode): Call {....raises: [], tags: [],
+    forbids: [].}
+
+ + perform a call to convert the destination to the source's type; the source can be any of a few usual suspects... + Source   +Edit   + +
+
+ +
+
+
+
proc filterPragma(ns: seq[PragmaAtom]; liftee: Name): NormNode {....raises: [],
+    tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc getContSym(n: NormNode): Name {....raises: [], tags: [], forbids: [].}
+
+ + Retrieve the continuation symbol from n, provided that n is a cpsCont. + Source   +Edit   + +
+
+ +
+
+
+
proc hash(n: NimNode): Hash {....raises: [], tags: [], forbids: [].}
+
+ + Hash a NimNode via it's representation + Source   +Edit   + +
+
+ +
+
+
+
proc isCpsBlock(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + true if the block n contains a cps call anywhere at all; this is used to figure out if a block needs tailcall handling... + Source   +Edit   + +
+
+ +
+
+
+
proc isCpsBreak(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + Return whether a node is a {.cpsBreak.} annotation + Source   +Edit   + +
+
+ +
+
+
+
proc isCpsCall(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + true if this node holds a call to a cps procedure + Source   +Edit   + +
+
+ +
+
+
+
proc isCpsCont(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + Return whether the given procedure is a cps continuation + Source   +Edit   + +
+
+ +
+
+
+
func isCpsContinue(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + Return whether a node is a {.cpsContinue.} annotation + Source   +Edit   + +
+
+ +
+
+
+
proc isCpsConvCall(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + true if this node holds a cps call that might be nested within one or more conversions. + Source   +Edit   + +
+
+ +
+
+
+
func isCpsPending(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + Return whether a node is a {.cpsPending.} annotation + Source   +Edit   + +
+
+ +
+
+
+
proc isCpsTerminate(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + Return whether n is a cpsTerminate annotation + Source   +Edit   + +
+
+ +
+
+
+
proc isScopeExit(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + Return whether the given node signify a CPS scope exit + Source   +Edit   + +
+
+ +
+
+
+
proc isVoodooCall(n: NormNode): bool {....raises: [], tags: [], forbids: [].}
+
+ + true if this is a call to a voodoo procedure + Source   +Edit   + +
+
+ +
+
+
+
proc makeErrorShim(n: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + Upgrades a procedure to serve as a CPS primitive, generating errors out of .cps. context and taking continuations as input. + Source   +Edit   + +
+
+ +
+
+
+
func matchCpsBreak(): NormMatcher {....raises: [], tags: [], forbids: [].}
+
+ + create a matcher matching cpsBreak with an empty label + Source   +Edit   + +
+
+
+
func matchCpsBreak(label: NormNode): NormMatcher {....raises: [], tags: [],
+    forbids: [].}
+
+ + create a matcher matching cpsBreak with the given label and cpsBreak without any label + Source   +Edit   + +
+
+ +
+
+
+
func newCpsBreak(n: NormNode; label = newNilLit().NormNode): NormNode {.
+    ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func newCpsContinue(n: NormNode): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
func newCpsPending(): PragmaStmt {....raises: [], tags: [], forbids: [].}
+
+ + Produce a {.cpsPending.} annotation + Source   +Edit   + +
+
+ +
+
+
+
proc newCpsTerminate(): NormNode {....raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
proc nilAsEmpty(n: NimNode): NimNode {....raises: [], tags: [], forbids: [].}
+
+ + normalize nil, nnkNilLit to nnkEmpty + Source   +Edit   + +
+
+ +
+
+
+
proc pragmaArgument(n: NormNode; s: string): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + from foo() or proc foo() {.some: Pragma.}, retrieve Pragma + Source   +Edit   + +
+
+ +
+
+
+
proc recover[C, R, P](callback: Callback[C, R, P]; continuation: var C): R
+
+ +

Using a callback, recover the result of the given continuation. This is equivalent to running () on a continuation which was created with whelp against a procedure call.

+

If the continuation is in the running State, this operation will trampoline the continuation until it is finished. The result will then be recovered from the continuation environment.

+

It is a Defect to attempt to recover the result of a dismissed continuation.

+ + Source   +Edit   + +
+
+ +
+
+
+
proc renderStackFrames(): seq[string] {.cpsVoodooCall, ...raises: [], tags: [],
+                                        forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc renderStackFrames(c: Continuation): seq[string] {....raises: [ValueError],
+    tags: [], forbids: [].}
+
+ + Render a "stack" trace for the continuation as a sequence of lines. + Source   +Edit   + +
+
+ +
+
+
+
proc renderTraceDeque(): seq[string] {.cpsVoodooCall, ...raises: [], tags: [],
+                                       forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc renderTraceDeque(c: Continuation): seq[string] {....raises: [ValueError],
+    tags: [], forbids: [].}
+
+ + Render a traceback for the continuation as a sequence of lines. + Source   +Edit   + +
+
+ +
+
+
+
proc stripPragma(n: NormNode; s: static[string]): NormNode
+
+ + filter a pragma with the matching name from various nodes + Source   +Edit   + +
+
+
+
proc stripPragma(n: PragmaStmt; s: static[string]): PragmaStmt
+
+ + filter a pragma with the matching name + Source   +Edit   + +
+
+ +
+
+
+
proc trampoline[T: Continuation](c: sink T): T
+
+ + This is the basic trampoline: it will run the continuation until the continuation is no longer in the Running state. + Source   +Edit   + +
+
+ +
+
+
+
func wrappedFinally(n, final: NormNode): NormNode {....raises: [], tags: [],
+    forbids: [].}
+
+ + rewrite a try/except/finally into try/try-except/finally + Source   +Edit   + +
+
+ +
+
+
+
proc writeStackFrames() {.cpsVoodooCall, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc writeStackFrames(c: Continuation) {....raises: [ValueError, IOError],
+    tags: [WriteIOEffect], forbids: [].}
+
+ + Write a "stack" trace for the continuation. + Source   +Edit   + +
+
+ +
+
+
+
proc writeTraceDeque() {.cpsVoodooCall, ...raises: [], tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+
+
proc writeTraceDeque(c: Continuation) {....raises: [ValueError, IOError],
+                                        tags: [WriteIOEffect], forbids: [].}
+
+ + Write a traceback for the continuation. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Macros

+
+
+
+
macro call[C; R; P](callback: Callback[C, R, P]; arguments: varargs[typed]): C
+
+ + Invoke a callback with the given arguments; returns a continuation. + Source   +Edit   + +
+
+ +
+
+
+
macro cpsMagic(n: untyped): untyped
+
+ +

Applied to a procedure to generate a version which lacks the first argument and return value, which are those of a Continuation.

+

This new magical will compile correctly inside CPS procedures though it never takes a Continuation argument and produces no return value.

+

The target procedure of a cpsMagic pragma returns the Continuation to which control-flow should return; this is usually the same value passed into the procedure, but this is not required nor is it checked!

+ + Source   +Edit   + +
+
+ +
+
+
+
macro cpsVoodoo(n: untyped): untyped
+
+ + Similar to a cpsMagic where the first argument is concerned, but may specify a return value which is usable inside the CPS procedure. + Source   +Edit   + +
+
+ +
+
+
+
macro etype(e: enum): string
+
+ + Coop -> "Coop", not "coop" + Source   +Edit   + +
+
+ +
+
+
+
macro trampolineIt[T: Continuation](supplied: T; body: untyped)
+
+ + This trampoline allows the user to interact with the continuation prior to each leg of its execution. The continuation will be exposed by a variable named it inside the body. + Source   +Edit   + +
+
+ +
+ +
+
+
+

Templates

+
+
+
+
template colon(a, b: NimNode): NimNode
+
+ + for constructing foo: bar in a ctor + Source   +Edit   + +
+
+
+
template colon(a: string | NimNode; b: string | int): NimNode
+
+ + for constructing foo: bar in a ctor + Source   +Edit   + +
+
+
+
template colon(a: string; b: NimNode): NimNode
+
+ + for constructing foo: bar in a ctor + Source   +Edit   + +
+
+ +
+
+
+
template cpsBootstrap(whelp: typed) {.pragma.}
+
+ + the symbol for creating a continuation -- technically, a whelp() + Source   +Edit   + +
+
+ +
+
+
+
template cpsBreak(label: typed = nil) {.pragma.}
+
+ + this is a break statement in a cps block + Source   +Edit   + +
+
+ +
+
+
+
template cpsCall() {.pragma.}
+
+ + a cps call + Source   +Edit   + +
+
+ +
+
+
+
template cpsCallback() {.pragma.}
+
+ + this is a callback typedef + Source   +Edit   + +
+
+ +
+
+
+
template cpsCallbackShim(whelp: typed) {.pragma.}
+
+ + the symbol for creating a continuation which returns a continuation base + Source   +Edit   + +
+
+ +
+
+
+
template cpsCont() {.pragma.}
+
+ + this is a continuation + Source   +Edit   + +
+
+ +
+
+
+
template cpsContinue() {.pragma.}
+
+ + this is a continue statement in a cps block + Source   +Edit   + +
+
+ +
+
+
+
template cpsEnvironment(tipe: typed) {.pragma.}
+
+ + the environment type that composed the target + Source   +Edit   + +
+
+ +
+
+
+
template cpsHasException(cont, ex: typed) {.pragma.}
+
+ + the continuation has an exception stored in ex, with cont being the continuation symbol used. + Source   +Edit   + +
+
+ +
+
+
+
template cpsLift() {.pragma.}
+
+ + lift this proc|type + Source   +Edit   + +
+
+ +
+
+
+
template cpsMagicCall() {.pragma.}
+
+ + a magic call + Source   +Edit   + +
+
+ +
+
+
+
template cpsMustJump() {.pragma.}
+
+ + cps calls and magic calls jump + Source   +Edit   + +
+
+ +
+
+
+
template cpsPending() {.pragma.}
+
+ + this is the last continuation + Source   +Edit   + +
+
+ +
+
+
+
template cpsResult(result: typed) {.pragma.}
+
+ + the procedure that returns the result of the continuation + Source   +Edit   + +
+
+ +
+
+
+
template cpsReturnType(tipe: typed) {.pragma.}
+
+ + the return type of the continuation + Source   +Edit   + +
+
+ +
+
+
+
template cpsTerminate() {.pragma.}
+
+ + this is the end of this procedure + Source   +Edit   + +
+
+ +
+
+
+
template cpsVoodooCall() {.pragma.}
+
+ + a voodoo call + Source   +Edit   + +
+
+ +
+
+
+
template debugAnnotation(s: typed; n: NimNode; body: untyped) {.dirty.}
+
+ + + Source   +Edit   + +
+
+ +
+
+
+
template dot(a, b: NimNode): NimNode
+
+ + for constructing foo.bar + Source   +Edit   + +
+
+
+
template dot(a: NimNode; b: string): NimNode
+
+ + for constructing .(foo, "bar") + Source   +Edit   + +
+
+ +
+
+
+
template eq(a, b: NimNode): NimNode
+
+ + for constructing foo=bar in a call + Source   +Edit   + +
+
+
+
template eq(a: string; b: NimNode): NimNode
+
+ + for constructing foo=bar in a call + Source   +Edit   + +
+
+ +
+
+
+
template rewriteIt(n: typed; body: untyped): NormNode
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + diff --git a/cps/spec.idx b/cps/spec.idx new file mode 100644 index 00000000..321a948e --- /dev/null +++ b/cps/spec.idx @@ -0,0 +1,105 @@ +nimTitle spec cps/spec.html module cps/spec 0 +nim cpsCallOperatorSupported cps/spec.html#cpsCallOperatorSupported const cpsCallOperatorSupported 14 +nim cpsLift cps/spec.html#cpsLift.t template cpsLift() 27 +nim cpsCall cps/spec.html#cpsCall.t template cpsCall() 28 +nim cpsMagicCall cps/spec.html#cpsMagicCall.t template cpsMagicCall() 29 +nim cpsVoodooCall cps/spec.html#cpsVoodooCall.t template cpsVoodooCall() 30 +nim cpsMustJump cps/spec.html#cpsMustJump.t template cpsMustJump() 31 +nim cpsPending cps/spec.html#cpsPending.t template cpsPending() 32 +nim cpsBreak cps/spec.html#cpsBreak.t,typed template cpsBreak(label: typed = nil) 33 +nim cpsContinue cps/spec.html#cpsContinue.t template cpsContinue() 35 +nim cpsCont cps/spec.html#cpsCont.t template cpsCont() 37 +nim cpsBootstrap cps/spec.html#cpsBootstrap.t,typed template cpsBootstrap(whelp: typed) 38 +nim cpsCallback cps/spec.html#cpsCallback.t template cpsCallback() 40 +nim cpsCallbackShim cps/spec.html#cpsCallbackShim.t,typed template cpsCallbackShim(whelp: typed) 41 +nim cpsEnvironment cps/spec.html#cpsEnvironment.t,typed template cpsEnvironment(tipe: typed) 43 +nim cpsResult cps/spec.html#cpsResult.t,typed template cpsResult(result: typed) 45 +nim cpsReturnType cps/spec.html#cpsReturnType.t,typed template cpsReturnType(tipe: typed) 47 +nim cpsTerminate cps/spec.html#cpsTerminate.t template cpsTerminate() 49 +nim cpsHasException cps/spec.html#cpsHasException.t,typed,typed template cpsHasException(cont, ex: typed) 50 +nim cpsStackFrames cps/spec.html#cpsStackFrames const cpsStackFrames 55 +nim cpsTraceDeque cps/spec.html#cpsTraceDeque const cpsTraceDeque 56 +nim traceDequeSize cps/spec.html#traceDequeSize const traceDequeSize 57 +nim ContinuationObj cps/spec.html#ContinuationObj object ContinuationObj 60 +nim Continuation cps/spec.html#Continuation type Continuation 72 +nim ContinuationProc cps/spec.html#ContinuationProc type ContinuationProc 74 +nim Callback cps/spec.html#Callback object Callback 76 +nim TraceFrame cps/spec.html#TraceFrame object TraceFrame 82 +nim Coop cps/spec.html#Coop Hook.Coop 87 +nim Trace cps/spec.html#Trace Hook.Trace 87 +nim Alloc cps/spec.html#Alloc Hook.Alloc 87 +nim Dealloc cps/spec.html#Dealloc Hook.Dealloc 87 +nim Pass cps/spec.html#Pass Hook.Pass 87 +nim Boot cps/spec.html#Boot Hook.Boot 87 +nim Unwind cps/spec.html#Unwind Hook.Unwind 87 +nim Head cps/spec.html#Head Hook.Head 87 +nim Tail cps/spec.html#Tail Hook.Tail 87 +nim Stack cps/spec.html#Stack Hook.Stack 87 +nim Hook cps/spec.html#Hook enum Hook 87 +nim dot cps/spec.html#dot.t,NimNode,NimNode template dot(a, b: NimNode): NimNode 108 +nim dot cps/spec.html#dot.t,NimNode,string template dot(a: NimNode; b: string): NimNode 112 +nim eq cps/spec.html#eq.t,NimNode,NimNode template eq(a, b: NimNode): NimNode 116 +nim eq cps/spec.html#eq.t,string,NimNode template eq(a: string; b: NimNode): NimNode 120 +nim colon cps/spec.html#colon.t,NimNode,NimNode template colon(a, b: NimNode): NimNode 124 +nim colon cps/spec.html#colon.t,string,NimNode template colon(a: string; b: NimNode): NimNode 128 +nim colon cps/spec.html#colon.t,, template colon(a: string | NimNode; b: string | int): NimNode 132 +nim filterPragma cps/spec.html#filterPragma,seq[PragmaAtom],Name proc filterPragma(ns: seq[PragmaAtom]; liftee: Name): NormNode 136 +nim stripPragma cps/spec.html#stripPragma,PragmaStmt,static[string] proc stripPragma(n: PragmaStmt; s: static[string]): PragmaStmt 140 +nim stripPragma cps/spec.html#stripPragma,NormNode,static[string] proc stripPragma(n: NormNode; s: static[string]): NormNode 144 +nim hash cps/spec.html#hash,NimNode proc hash(n: NimNode): Hash 169 +nim newCpsPending cps/spec.html#newCpsPending proc newCpsPending(): PragmaStmt 175 +nim isCpsPending cps/spec.html#isCpsPending,NormNode proc isCpsPending(n: NormNode): bool 179 +nim newCpsBreak cps/spec.html#newCpsBreak,NormNode proc newCpsBreak(n: NormNode; label = newNilLit().NormNode): NormNode 183 +nim isCpsBreak cps/spec.html#isCpsBreak,NormNode proc isCpsBreak(n: NormNode): bool 193 +nim newCpsContinue cps/spec.html#newCpsContinue,NormNode proc newCpsContinue(n: NormNode): NormNode 197 +nim isCpsContinue cps/spec.html#isCpsContinue,NormNode proc isCpsContinue(n: NormNode): bool 201 +nim breakLabel cps/spec.html#breakLabel,NormNode proc breakLabel(n: NormNode): NormNode 205 +nim isCpsCont cps/spec.html#isCpsCont,NormNode proc isCpsCont(n: NormNode): bool 217 +nim getContSym cps/spec.html#getContSym,NormNode proc getContSym(n: NormNode): Name 221 +nim newCpsTerminate cps/spec.html#newCpsTerminate proc newCpsTerminate(): NormNode 229 +nim isCpsTerminate cps/spec.html#isCpsTerminate,NormNode proc isCpsTerminate(n: NormNode): bool 233 +nim isScopeExit cps/spec.html#isScopeExit,NormNode proc isScopeExit(n: NormNode): bool 237 +nim rewriteIt cps/spec.html#rewriteIt.t,typed,untyped template rewriteIt(n: typed; body: untyped): NormNode 241 +nim debugAnnotation cps/spec.html#debugAnnotation.t,typed,NimNode,untyped template debugAnnotation(s: typed; n: NimNode; body: untyped) 247 +nim matchCpsBreak cps/spec.html#matchCpsBreak,NormNode proc matchCpsBreak(label: NormNode): NormMatcher 253 +nim matchCpsBreak cps/spec.html#matchCpsBreak proc matchCpsBreak(): NormMatcher 264 +nim wrappedFinally cps/spec.html#wrappedFinally,NormNode,NormNode proc wrappedFinally(n, final: NormNode): NormNode 268 +nim isVoodooCall cps/spec.html#isVoodooCall,NormNode proc isVoodooCall(n: NormNode): bool 277 +nim isCpsCall cps/spec.html#isCpsCall,NormNode proc isCpsCall(n: NormNode): bool 283 +nim isCpsConvCall cps/spec.html#isCpsConvCall,NormNode proc isCpsConvCall(n: NormNode): bool 298 +nim isCpsBlock cps/spec.html#isCpsBlock,NormNode proc isCpsBlock(n: NormNode): bool 307 +nim pragmaArgument cps/spec.html#pragmaArgument,NormNode,string proc pragmaArgument(n: NormNode; s: string): NormNode 332 +nim bootstrapSymbol cps/spec.html#bootstrapSymbol,NimNode proc bootstrapSymbol(n: NimNode): NormNode 354 +nim enbasen cps/spec.html#enbasen,NimNode proc enbasen(n: NimNode): TypeExpr 371 +nim State cps/spec.html#State enum State 388 +nim makeErrorShim cps/spec.html#makeErrorShim,NimNode proc makeErrorShim(n: NimNode): NimNode 394 +nim cpsMagic cps/spec.html#cpsMagic.m,untyped macro cpsMagic(n: untyped): untyped 410 +nim cpsVoodoo cps/spec.html#cpsVoodoo.m,untyped macro cpsVoodoo(n: untyped): untyped 432 +nim renderStackFrames cps/spec.html#renderStackFrames,Continuation proc renderStackFrames(c: Continuation): seq[string] 464 +nim renderStackFrames cps/spec.html#renderStackFrames proc renderStackFrames(): seq[string] 464 +nim renderTraceDeque cps/spec.html#renderTraceDeque,Continuation proc renderTraceDeque(c: Continuation): seq[string] 468 +nim renderTraceDeque cps/spec.html#renderTraceDeque proc renderTraceDeque(): seq[string] 468 +nim writeStackFrames cps/spec.html#writeStackFrames,Continuation proc writeStackFrames(c: Continuation) 495 +nim writeStackFrames cps/spec.html#writeStackFrames proc writeStackFrames() 495 +nim writeTraceDeque cps/spec.html#writeTraceDeque,Continuation proc writeTraceDeque(c: Continuation) 499 +nim writeTraceDeque cps/spec.html#writeTraceDeque proc writeTraceDeque() 499 +nim trampoline cps/spec.html#trampoline,sinkT proc trampoline[T: Continuation](c: sink T): T 504 +nim trampolineIt cps/spec.html#trampolineIt.m,T,untyped macro trampolineIt[T: Continuation](supplied: T; body: untyped) 519 +nim ensimilate cps/spec.html#ensimilate,NormNode,NormNode proc ensimilate(source, destination: NormNode): Call 544 +nim nilAsEmpty cps/spec.html#nilAsEmpty,NimNode proc nilAsEmpty(n: NimNode): NimNode 568 +nim emptyAsNil cps/spec.html#emptyAsNil,NimNode proc emptyAsNil(n: NimNode): NimNode 575 +nim etype cps/spec.html#etype.m macro etype(e: enum): string 582 +nim copyOrVoid cps/spec.html#copyOrVoid,NimNode proc copyOrVoid(n: NimNode): NimNode 589 +nim createCallback cps/spec.html#createCallback,NimNode proc createCallback(sym: NimNode): NimNode 596 +nim cpsCallbackTypeDef cps/spec.html#cpsCallbackTypeDef,NimNode,NimNode proc cpsCallbackTypeDef(tipe: NimNode; n: NimNode): NimNode 615 +nim recover cps/spec.html#recover,Callback[C,R,P],C proc recover[C, R, P](callback: Callback[C, R, P]; continuation: var C): R 626 +nim call cps/spec.html#call.m,Callback[C,R,P],varargs[typed] macro call[C; R; P](callback: Callback[C, R, P]; arguments: varargs[typed]): C 639 +nimgrp renderstackframes cps/spec.html#renderStackFrames-procs-all proc 464 +nimgrp writetracedeque cps/spec.html#writeTraceDeque-procs-all proc 499 +nimgrp rendertracedeque cps/spec.html#renderTraceDeque-procs-all proc 468 +nimgrp matchcpsbreak cps/spec.html#matchCpsBreak-procs-all proc 253 +nimgrp strippragma cps/spec.html#stripPragma-procs-all proc 140 +nimgrp writestackframes cps/spec.html#writeStackFrames-procs-all proc 495 +nimgrp colon cps/spec.html#colon-templates-all template 124 +nimgrp eq cps/spec.html#eq-templates-all template 116 +nimgrp dot cps/spec.html#dot-templates-all template 108 diff --git a/cps/transform.html b/cps/transform.html new file mode 100644 index 00000000..a0390057 --- /dev/null +++ b/cps/transform.html @@ -0,0 +1,206 @@ + + + + + + + +cps/transform + + + + + + + + + + + + +
+
+

cps/transform

+
+
+
+ + +
+ +
+ Search: +
+
+ Group by: + +
+ + +
+
+ Source   +Edit   + +
+ +

+ +
+

Procs

+
+
+
+
proc performUntypedPass(tipe: NimNode; n: NimNode): NimNode {.
+    ...raises: [Exception], tags: [RootEffect], forbids: [].}
+
+ + Perform any rewrites needed prior to a .cps: T. transformation. + Source   +Edit   + +
+
+ +
+
+
+
proc rewriteCalls(n: NimNode): NimNode {....raises: [Exception],
+    tags: [RootEffect], forbids: [].}
+
+ + rewriting callback(x) into recover(callback, call(callback, x)) for use inside of an untyped pass; this should be applied only to Callback symbols... + Source   +Edit   + +
+
+ +
+
+
+
proc unwind(c: sink Continuation; e: ref Exception): Continuation {.used,
+    ...raises: [Exception], tags: [], forbids: [].}
+
+ + Reimplement this symbol to customize stack unwind. + Source   +Edit   + +
+
+
+
proc unwind(e: ref Exception) {.used, cpsMustJump, cpsMagicCall, ...raises: [],
+                                tags: [], forbids: [].}
+
+ + + Source   +Edit   + +
+
+ +
+ +
+
+
+

Macros

+
+
+
+
macro cpsTransform(tipe, n: typed): untyped
+
+ + This is the macro performing the main cps transformation + Source   +Edit   + +
+
+ +
+ +
+
+ + +
+
+ + +
+
+ + + + + + diff --git a/cps/transform.idx b/cps/transform.idx new file mode 100644 index 00000000..efe3f102 --- /dev/null +++ b/cps/transform.idx @@ -0,0 +1,7 @@ +nimTitle transform cps/transform.html module cps/transform 0 +nim unwind cps/transform.html#unwind,sinkContinuation,ref.Exception proc unwind(c: sink Continuation; e: ref Exception): Continuation 1065 +nim unwind cps/transform.html#unwind,ref.Exception proc unwind(e: ref Exception) 1066 +nim cpsTransform cps/transform.html#cpsTransform.m,typed,typed macro cpsTransform(tipe, n: typed): untyped 1260 +nim rewriteCalls cps/transform.html#rewriteCalls,NimNode proc rewriteCalls(n: NimNode): NimNode 1317 +nim performUntypedPass cps/transform.html#performUntypedPass,NimNode,NimNode proc performUntypedPass(tipe: NimNode; n: NimNode): NimNode 1330 +nimgrp unwind cps/transform.html#unwind-procs-all proc 1065 diff --git a/demo.svg b/demo.svg new file mode 100644 index 00000000..4a1cb2d1 --- /dev/null +++ b/demo.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + 🎪tramp &140292803854416 at 0🤞queue {1} now 1 items⏰timer [6]💈delay {1} 300 milliseconds, 11 microseconds, and 253 nanoseconds🎪tramp &140292803854416 at 274718198418880tick 9🤞queue {2} now 2 items🎪tramp &140292803854704 at 0🤞queue {3} now 2 items⏰timer [7]d💈delay {2} 300 milliseconds, 27 microseconds, and 804 nanoseconds🎪tramp &140292803854416 at 274718498510819tick 8🤞queue {4} now 2 itemsocs💈delay {4} 300 milliseconds, 4 microseconds, and 899 nanoseconds🎪tramp &140292803854416 at 274718798587796tick 7🤞queue {5} now 2 items💈delay {3} 100 milliseconds, 41 microseconds, and 897 nanoseconds🎪tramp &140292803854704 at 274719098652716tock 9🤞queue {6} now 2 items;💈delay {5} 200 milliseconds, 52 microseconds, and 648 nanoseconds🎪tramp &140292803854416 at 274719198762089tick 6🤞queue {7} now 2 items💈delay {7} 300 milliseconds, 168 microseconds, and 615 nanoseconds🎪tramp &140292803854416 at 274719398874174tick 5🤞queue {8} now 2 items💈delay {6} 199 milliseconds, 836 microseconds, and 488 nanoseconds🎪tramp &140292803854704 at 274719699107578tock 8🤞queue {9} now 2 items💈delay {8} 100 milliseconds, 280 microseconds, and 548 nanoseconds🎪tramp &140292803854416 at 274719898992873tick 4🤞queue {10} now 2 items💈delay {10} 300 milliseconds, 111 microseconds, and 264 nanoseconds🎪tramp &140292803854416 at 274719999335273tick 3🤞queue {11} now 2 items💈delay {9} 299 milliseconds, 622 microseconds, and 44 nanoseconds🎪tramp &140292803854704 at 274720299550347tock 7🤞queue {12} now 2 items💈delay {11} 302 microseconds and 158 nanoseconds🎪tramp &140292803854416 at 274720599232365tick 2🤞queue {13} now 2 items💈delay {13} 300 milliseconds, 185 microseconds, and 297 nanoseconds🎪tramp &140292803854416 at 274720599565192tick 1🤞queue {14} now 2 items 💈delay {14} 300 milliseconds, 187 microseconds, and 335 nanoseconds🎪tramp &140292803854416 at 274720899795715tick 0-💈delay {12} 99 milliseconds, 358 microseconds, and 410 nanoseconds🎪tramp &140292803854704 at 274721200015579tock 6🤞queue {15} now 1 itemsm "💈delay {15} 700 milliseconds, 145 microseconds, and 609 nanoseconds🎪tramp &140292803854704 at 274721299432657tock 5🤞queue {16} now 1 itemsupda💈delay {16} 700 milliseconds, 168 microseconds, and 671 nanoseconds🎪tramp &140292803854704 at 274721999635762tock 4🤞queue {17} now 1 itemste 💈delay {17} 700 milliseconds, 34 microseconds, and 703 nanoseconds🎪tramp &140292803854704 at 274722699850053tock 3🤞queue {18} now 1 itemsdemos💈delay {18} 700 milliseconds, 166 microseconds, and 182 nanoseconds🎪tramp &140292803854704 at 274723399944634tock 2🤞queue {19} now 1 items"💈delay {19} 700 milliseconds, 88 microseconds, and 32 nanoseconds🎪tramp &140292803854704 at 274724100170861tock 1🤞queue {20} now 1 items💈delay {20} 700 milliseconds, 20 microseconds, and 193 nanoseconds🎪tramp &140292803854704 at 274724800317427tock 0 + \ No newline at end of file diff --git a/dochack.js b/dochack.js new file mode 100644 index 00000000..3c6a6797 --- /dev/null +++ b/dochack.js @@ -0,0 +1,1607 @@ +/* Generated by the Nim Compiler v2.1.1 */ +var framePtr = null; +var excHandler = 0; +var lastJSError = null; +var NTI33554466 = {size: 0,kind: 1,base: null,node: null,finalizer: null}; +var NTI704643086 = {size: 0, kind: 18, base: null, node: null, finalizer: null}; +var NTI33554435 = {size: 0,kind: 31,base: null,node: null,finalizer: null}; +var NTI939524173 = {size: 0,kind: 31,base: null,node: null,finalizer: null}; +var NTI939524179 = {size: 0, kind: 18, base: null, node: null, finalizer: null}; +var NTI134217745 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217749 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217751 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI33555169 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI33555177 = {size: 0, kind: 22, base: null, node: null, finalizer: null}; +var NTI33554449 = {size: 0,kind: 28,base: null,node: null,finalizer: null}; +var NTI33554450 = {size: 0,kind: 29,base: null,node: null,finalizer: null}; +var NTI33555176 = {size: 0, kind: 22, base: null, node: null, finalizer: null}; +var NTI33555173 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI33555174 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217741 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NTI134217743 = {size: 0, kind: 17, base: null, node: null, finalizer: null}; +var NNI134217743 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217743.node = NNI134217743; +var NNI134217741 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217741.node = NNI134217741; +var NNI33555174 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI33555174.node = NNI33555174; +NTI33555176.base = NTI33555173; +NTI33555177.base = NTI33555173; +var NNI33555173 = {kind: 2, len: 5, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "parent", len: 0, typ: NTI33555176, name: "parent", sons: null}, +{kind: 1, offset: "name", len: 0, typ: NTI33554450, name: "name", sons: null}, +{kind: 1, offset: "message", len: 0, typ: NTI33554449, name: "msg", sons: null}, +{kind: 1, offset: "trace", len: 0, typ: NTI33554449, name: "trace", sons: null}, +{kind: 1, offset: "up", len: 0, typ: NTI33555177, name: "up", sons: null}]}; +NTI33555173.node = NNI33555173; +var NNI33555169 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI33555169.node = NNI33555169; +NTI33555173.base = NTI33555169; +NTI33555174.base = NTI33555173; +NTI134217741.base = NTI33555174; +NTI134217743.base = NTI134217741; +var NNI134217751 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217751.node = NNI134217751; +NTI134217751.base = NTI33555174; +var NNI134217749 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217749.node = NNI134217749; +NTI134217749.base = NTI33555174; +var NNI134217745 = {kind: 2, len: 0, offset: 0, typ: null, name: null, sons: []}; +NTI134217745.node = NNI134217745; +NTI134217745.base = NTI33555174; +var NNI939524179 = {kind: 2, len: 2, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "a", len: 0, typ: NTI939524173, name: "a", sons: null}, +{kind: 1, offset: "b", len: 0, typ: NTI33554435, name: "b", sons: null}]}; +NTI939524179.node = NNI939524179; +var NNI704643086 = {kind: 2, len: 2, offset: 0, typ: null, name: null, sons: [{kind: 1, offset: "Field0", len: 0, typ: NTI33554435, name: "Field0", sons: null}, +{kind: 1, offset: "Field1", len: 0, typ: NTI33554466, name: "Field1", sons: null}]}; +NTI704643086.node = NNI704643086; + +function mnewString(len_33556985) { + return new Array(len_33556985); + + + +} + +function toJSStr(s_33556886) { + var result_33556887 = null; + + var res_33556928 = newSeq_33556904((s_33556886).length); + var i_33556929 = 0; + var j_33556930 = 0; + Label1: { + Label2: while (true) { + if (!(i_33556929 < (s_33556886).length)) break Label2; + var c_33556931 = s_33556886[i_33556929]; + if ((c_33556931 < 128)) { + res_33556928[j_33556930] = String.fromCharCode(c_33556931); + i_33556929 += 1; + } + else { + var helper_33556943 = newSeq_33556904(0); + Label3: { + Label4: while (true) { + if (!true) break Label4; + var code_33556944 = c_33556931.toString(16); + if ((((code_33556944) == null ? 0 : (code_33556944).length) == 1)) { + helper_33556943.push("%0");; + } + else { + helper_33556943.push("%");; + } + + helper_33556943.push(code_33556944);; + i_33556929 += 1; + if ((((s_33556886).length <= i_33556929) || (s_33556886[i_33556929] < 128))) { + break Label3; + } + + c_33556931 = s_33556886[i_33556929]; + } + }; +++excHandler; + try { + res_33556928[j_33556930] = decodeURIComponent(helper_33556943.join("")); +--excHandler; +} catch (EXCEPTION) { + var prevJSError = lastJSError; + lastJSError = EXCEPTION; + --excHandler; + res_33556928[j_33556930] = helper_33556943.join(""); + lastJSError = prevJSError; + } finally { + } + } + + j_33556930 += 1; + } + }; + if (res_33556928.length < j_33556930) { for (var i = res_33556928.length ; i < j_33556930 ; ++i) res_33556928.push(null); } + else { res_33556928.length = j_33556930; }; + result_33556887 = res_33556928.join(""); + + return result_33556887; + +} + +function raiseException(e_33556638, ename_33556639) { + e_33556638.name = ename_33556639; + if ((excHandler == 0)) { + unhandledException(e_33556638); + } + + throw e_33556638; + + +} + +function addInt(a_33557032, b_33557033) { + var result = a_33557032 + b_33557033; + checkOverflowInt(result); + return result; + + + +} + +function chckRange(i_33557306, a_33557307, b_33557308) { + var result_33557309 = 0; + + BeforeRet: { + if (((a_33557307 <= i_33557306) && (i_33557306 <= b_33557308))) { + result_33557309 = i_33557306; + break BeforeRet; + } + else { + raiseRangeError(); + } + + }; + + return result_33557309; + +} + +function setConstr() { + var result = {}; + for (var i = 0; i < arguments.length; ++i) { + var x = arguments[i]; + if (typeof(x) == "object") { + for (var j = x[0]; j <= x[1]; ++j) { + result[j] = true; + } + } else { + result[x] = true; + } + } + return result; + + + +} +var ConstSet1 = setConstr(17, 16, 4, 18, 27, 19, 23, 22, 21); + +function nimCopy(dest_33557250, src_33557251, ti_33557252) { + var result_33557261 = null; + + switch (ti_33557252.kind) { + case 21: + case 22: + case 23: + case 5: + if (!(isFatPointer_33557241(ti_33557252))) { + result_33557261 = src_33557251; + } + else { + result_33557261 = [src_33557251[0], src_33557251[1]]; + } + + break; + case 19: + if (dest_33557250 === null || dest_33557250 === undefined) { + dest_33557250 = {}; + } + else { + for (var key in dest_33557250) { delete dest_33557250[key]; } + } + for (var key in src_33557251) { dest_33557250[key] = src_33557251[key]; } + result_33557261 = dest_33557250; + + break; + case 18: + case 17: + if (!((ti_33557252.base == null))) { + result_33557261 = nimCopy(dest_33557250, src_33557251, ti_33557252.base); + } + else { + if ((ti_33557252.kind == 17)) { + result_33557261 = (dest_33557250 === null || dest_33557250 === undefined) ? {m_type: ti_33557252} : dest_33557250; + } + else { + result_33557261 = (dest_33557250 === null || dest_33557250 === undefined) ? {} : dest_33557250; + } + } + nimCopyAux(result_33557261, src_33557251, ti_33557252.node); + break; + case 4: + case 16: + if(ArrayBuffer.isView(src_33557251)) { + if(dest_33557250 === null || dest_33557250 === undefined || dest_33557250.length != src_33557251.length) { + dest_33557250 = new src_33557251.constructor(src_33557251); + } else { + dest_33557250.set(src_33557251, 0); + } + result_33557261 = dest_33557250; + } else { + if (src_33557251 === null) { + result_33557261 = null; + } + else { + if (dest_33557250 === null || dest_33557250 === undefined || dest_33557250.length != src_33557251.length) { + dest_33557250 = new Array(src_33557251.length); + } + result_33557261 = dest_33557250; + for (var i = 0; i < src_33557251.length; ++i) { + result_33557261[i] = nimCopy(result_33557261[i], src_33557251[i], ti_33557252.base); + } + } + } + + break; + case 24: + case 27: + if (src_33557251 === null) { + result_33557261 = null; + } + else { + if (dest_33557250 === null || dest_33557250 === undefined || dest_33557250.length != src_33557251.length) { + dest_33557250 = new Array(src_33557251.length); + } + result_33557261 = dest_33557250; + for (var i = 0; i < src_33557251.length; ++i) { + result_33557261[i] = nimCopy(result_33557261[i], src_33557251[i], ti_33557252.base); + } + } + + break; + case 28: + if (src_33557251 !== null) { + result_33557261 = src_33557251.slice(0); + } + + break; + default: + result_33557261 = src_33557251; + break; + } + + return result_33557261; + +} + +function chckIndx(i_33557301, a_33557302, b_33557303) { + var result_33557304 = 0; + + BeforeRet: { + if (((a_33557302 <= i_33557301) && (i_33557301 <= b_33557303))) { + result_33557304 = i_33557301; + break BeforeRet; + } + else { + raiseIndexError(i_33557301, a_33557302, b_33557303); + } + + }; + + return result_33557304; + +} + +function makeNimstrLit(c_33556880) { + var result = []; + for (var i = 0; i < c_33556880.length; ++i) { + result[i] = c_33556880.charCodeAt(i); + } + return result; + + + +} + +function subInt(a_33557036, b_33557037) { + var result = a_33557036 - b_33557037; + checkOverflowInt(result); + return result; + + + +} + +function cstrToNimstr(c_33556883) { + var ln = c_33556883.length; + var result = new Array(ln); + var r = 0; + for (var i = 0; i < ln; ++i) { + var ch = c_33556883.charCodeAt(i); + + if (ch < 128) { + result[r] = ch; + } + else { + if (ch < 2048) { + result[r] = (ch >> 6) | 192; + } + else { + if (ch < 55296 || ch >= 57344) { + result[r] = (ch >> 12) | 224; + } + else { + ++i; + ch = 65536 + (((ch & 1023) << 10) | (c_33556883.charCodeAt(i) & 1023)); + result[r] = (ch >> 18) | 240; + ++r; + result[r] = ((ch >> 12) & 63) | 128; + } + ++r; + result[r] = ((ch >> 6) & 63) | 128; + } + ++r; + result[r] = (ch & 63) | 128; + } + ++r; + } + return result; + + + +} +var ConstSet2 = setConstr([65, 90]); +var ConstSet3 = setConstr(95, 32, 46); +var ConstSet4 = setConstr(95, 32, 46); + +function mulInt(a_33557040, b_33557041) { + var result = a_33557040 * b_33557041; + checkOverflowInt(result); + return result; + + + +} +var ConstSet5 = setConstr([97, 122]); +var ConstSet6 = setConstr([65, 90], [97, 122]); +var ConstSet7 = setConstr([97, 122]); +var ConstSet8 = setConstr([65, 90]); +var ConstSet9 = setConstr([65, 90], [97, 122]); + +function nimMax(a_33557090, b_33557091) { + var Temporary1; + + var result_33557092 = 0; + + BeforeRet: { + if ((b_33557091 <= a_33557090)) { + Temporary1 = a_33557090; + } + else { + Temporary1 = b_33557091; + } + + result_33557092 = Temporary1; + break BeforeRet; + }; + + return result_33557092; + +} + +function nimMin(a_33557086, b_33557087) { + var Temporary1; + + var result_33557088 = 0; + + BeforeRet: { + if ((a_33557086 <= b_33557087)) { + Temporary1 = a_33557086; + } + else { + Temporary1 = b_33557087; + } + + result_33557088 = Temporary1; + break BeforeRet; + }; + + return result_33557088; + +} + +function addChar(x_33557397, c_33557398) { + x_33557397.push(c_33557398); + + +} +var objectID_1157628079 = [0]; + +function setTheme(theme_553648134) { + document.documentElement.setAttribute("data-theme", theme_553648134); + window.localStorage.setItem("theme", theme_553648134); + + +} + +function add_33556361(x_33556362, x_33556362_Idx, y_33556363) { + if (x_33556362[x_33556362_Idx] === null) { x_33556362[x_33556362_Idx] = []; } + var off = x_33556362[x_33556362_Idx].length; + x_33556362[x_33556362_Idx].length += y_33556363.length; + for (var i = 0; i < y_33556363.length; ++i) { + x_33556362[x_33556362_Idx][off+i] = y_33556363.charCodeAt(i); + } + + + +} + +function newSeq_33556904(len_33556906) { + var result_33556907 = []; + + result_33556907 = new Array(len_33556906); for (var i = 0 ; i < len_33556906 ; ++i) { result_33556907[i] = null; } + return result_33556907; + +} + +function unhandledException(e_33556634) { + var buf_33556635 = [[]]; + if (!(((e_33556634.message).length == 0))) { + buf_33556635[0].push.apply(buf_33556635[0], [69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110,58,32]);; + buf_33556635[0].push.apply(buf_33556635[0], e_33556634.message);; + } + else { + buf_33556635[0].push.apply(buf_33556635[0], [69,114,114,111,114,58,32,117,110,104,97,110,100,108,101,100,32,101,120,99,101,112,116,105,111,110]);; + } + + buf_33556635[0].push.apply(buf_33556635[0], [32,91]);; + add_33556361(buf_33556635, 0, e_33556634.name); + buf_33556635[0].push.apply(buf_33556635[0], [93,10]);; + var cbuf_33556636 = toJSStr(buf_33556635[0]); + if (typeof(Error) !== "undefined") { + throw new Error(cbuf_33556636); + } + else { + throw cbuf_33556636; + } + + + +} + +function raiseOverflow() { + raiseException({message: [111,118,101,114,45,32,111,114,32,117,110,100,101,114,102,108,111,119], parent: null, m_type: NTI134217743, name: null, trace: [], up: null}, "OverflowDefect"); + + +} + +function checkOverflowInt(a_33557030) { + if (a_33557030 > 2147483647 || a_33557030 < -2147483648) raiseOverflow(); + + + +} + +function raiseRangeError() { + raiseException({message: [118,97,108,117,101,32,111,117,116,32,111,102,32,114,97,110,103,101], parent: null, m_type: NTI134217751, name: null, trace: [], up: null}, "RangeDefect"); + + +} + +function addChars_301990087(result_301990089, result_301990089_Idx, x_301990090, start_301990091, n_301990092) { + var Temporary1; + + var old_301990093 = (result_301990089[result_301990089_Idx]).length; + if (result_301990089[result_301990089_Idx].length < (Temporary1 = chckRange(addInt(old_301990093, n_301990092), 0, 2147483647), Temporary1)) { for (var i = result_301990089[result_301990089_Idx].length; i < Temporary1; ++i) result_301990089[result_301990089_Idx].push(0); } + else {result_301990089[result_301990089_Idx].length = Temporary1; }; + Label2: { + var iHEX60gensym4_301990107 = 0; + var i_553649320 = 0; + Label3: { + Label4: while (true) { + if (!(i_553649320 < n_301990092)) break Label4; + iHEX60gensym4_301990107 = i_553649320; + result_301990089[result_301990089_Idx][chckIndx(addInt(old_301990093, iHEX60gensym4_301990107), 0, (result_301990089[result_301990089_Idx]).length - 1)] = x_301990090.charCodeAt(chckIndx(addInt(start_301990091, iHEX60gensym4_301990107), 0, (x_301990090).length - 1)); + i_553649320 = addInt(i_553649320, 1); + } + }; + }; + + +} + +function addChars_301990083(result_301990085, result_301990085_Idx, x_301990086) { + addChars_301990087(result_301990085, result_301990085_Idx, x_301990086, 0, ((x_301990086) == null ? 0 : (x_301990086).length)); + + +} + +function addInt_301990108(result_301990109, result_301990109_Idx, x_301990110) { + addChars_301990083(result_301990109, result_301990109_Idx, ((x_301990110) + "")); + + +} + +function addInt_301990126(result_301990127, result_301990127_Idx, x_301990128) { + addInt_301990108(result_301990127, result_301990127_Idx, BigInt(x_301990128)); + + +} + +function HEX24_385875976(x_385875977) { + var result_385875978 = [[]]; + + addInt_301990126(result_385875978, 0, x_385875977); + + return result_385875978[0]; + +} + +function isFatPointer_33557241(ti_33557242) { + var result_33557243 = false; + + BeforeRet: { + result_33557243 = !((ConstSet1[ti_33557242.base.kind] != undefined)); + break BeforeRet; + }; + + return result_33557243; + +} + +function nimCopyAux(dest_33557254, src_33557255, n_33557256) { + switch (n_33557256.kind) { + case 0: + break; + case 1: + dest_33557254[n_33557256.offset] = nimCopy(dest_33557254[n_33557256.offset], src_33557255[n_33557256.offset], n_33557256.typ); + + break; + case 2: + for (var i = 0; i < n_33557256.sons.length; i++) { + nimCopyAux(dest_33557254, src_33557255, n_33557256.sons[i]); + } + + break; + case 3: + dest_33557254[n_33557256.offset] = nimCopy(dest_33557254[n_33557256.offset], src_33557255[n_33557256.offset], n_33557256.typ); + for (var i = 0; i < n_33557256.sons.length; ++i) { + nimCopyAux(dest_33557254, src_33557255, n_33557256.sons[i][1]); + } + + break; + } + + +} + +function raiseIndexError(i_33556797, a_33556798, b_33556799) { + var Temporary1; + + if ((b_33556799 < a_33556798)) { + Temporary1 = [105,110,100,101,120,32,111,117,116,32,111,102,32,98,111,117,110,100,115,44,32,116,104,101,32,99,111,110,116,97,105,110,101,114,32,105,115,32,101,109,112,116,121]; + } + else { + Temporary1 = ([105,110,100,101,120,32] || []).concat(HEX24_385875976(i_33556797) || [],[32,110,111,116,32,105,110,32] || [],HEX24_385875976(a_33556798) || [],[32,46,46,32] || [],HEX24_385875976(b_33556799) || []); + } + + raiseException({message: nimCopy(null, Temporary1, NTI33554449), parent: null, m_type: NTI134217749, name: null, trace: [], up: null}, "IndexDefect"); + + +} + +function sysFatal_268435501(message_268435504) { + raiseException({message: nimCopy(null, message_268435504, NTI33554449), m_type: NTI134217745, parent: null, name: null, trace: [], up: null}, "AssertionDefect"); + + +} + +function raiseAssert_268435499(msg_268435500) { + sysFatal_268435501(msg_268435500); + + +} + +function failedAssertImpl_268435541(msg_268435542) { + raiseAssert_268435499(msg_268435542); + + +} + +function onDOMLoaded(e_553648169) { + +function HEX3Aanonymous_553648192(event_553648193) { + event_553648193.target.parentNode.style.display = "none"; + event_553648193.target.parentNode.nextSibling.style.display = "inline"; + + + } + + document.getElementById("theme-select").value = window.localStorage.getItem("theme"); + Label1: { + var pragmaDots_553648191 = null; + var colontmp__553649311 = []; + colontmp__553649311 = document.getElementsByClassName("pragmadots"); + var i_553649313 = 0; + var L_553649314 = (colontmp__553649311).length; + Label2: { + Label3: while (true) { + if (!(i_553649313 < L_553649314)) break Label3; + pragmaDots_553648191 = colontmp__553649311[chckIndx(i_553649313, 0, (colontmp__553649311).length - 1)]; + pragmaDots_553648191.onclick = HEX3Aanonymous_553648192; + i_553649313 += 1; + if (!(((colontmp__553649311).length == L_553649314))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + + +} + +function isWhitespace_553648533(x_553648534) { + var result_553648535 = false; + + result_553648535 = (((x_553648534.nodeName == "#text") && !/\S/.test(x_553648534.textContent)) || (x_553648534.nodeName == "#comment")); + + return result_553648535; + +} + +function toToc_553648536(x_553648537, father_553648538) { + var Temporary5; + var Temporary6; + var Temporary7; + var Temporary8; + var Temporary15; + + if ((x_553648537.nodeName == "UL")) { + var f_553648546 = {heading: null, kids: [], sortId: (father_553648538.kids).length, doSort: false}; + var i_553648547 = 0; + Label1: { + Label2: while (true) { + if (!(i_553648547 < x_553648537.childNodes.length)) break Label2; + var nxt_553648548 = addInt(i_553648547, 1); + Label3: { + Label4: while (true) { + if (!(nxt_553648548 < x_553648537.childNodes.length)) Temporary5 = false; else { Temporary5 = isWhitespace_553648533(x_553648537.childNodes[nxt_553648548]); } if (!Temporary5) break Label4; + nxt_553648548 = addInt(nxt_553648548, 1); + } + }; + if (!(nxt_553648548 < x_553648537.childNodes.length)) Temporary8 = false; else { Temporary8 = (x_553648537.childNodes[i_553648547].nodeName == "LI"); } if (!Temporary8) Temporary7 = false; else { Temporary7 = (x_553648537.childNodes[i_553648547].childNodes.length == 1); } if (!Temporary7) Temporary6 = false; else { Temporary6 = (x_553648537.childNodes[nxt_553648548].nodeName == "UL"); } if (Temporary6) { + var e_553648560 = {heading: x_553648537.childNodes[i_553648547].childNodes[0], kids: [], sortId: (f_553648546.kids).length, doSort: false}; + var it_553648561 = x_553648537.childNodes[nxt_553648548]; + Label9: { + var j_553648566 = 0; + var colontmp__553649327 = 0; + colontmp__553649327 = it_553648561.childNodes.length; + var i_553649328 = 0; + Label10: { + Label11: while (true) { + if (!(i_553649328 < colontmp__553649327)) break Label11; + j_553648566 = i_553649328; + toToc_553648536(it_553648561.childNodes[j_553648566], e_553648560); + i_553649328 = addInt(i_553649328, 1); + } + }; + }; + f_553648546.kids.push(e_553648560);; + i_553648547 = addInt(nxt_553648548, 1); + } + else { + toToc_553648536(x_553648537.childNodes[i_553648547], f_553648546); + i_553648547 = addInt(i_553648547, 1); + } + + } + }; + father_553648538.kids.push(f_553648546);; + } + else { + if (isWhitespace_553648533(x_553648537)) { + } + else { + if ((x_553648537.nodeName == "LI")) { + var idx_553648583 = []; + Label12: { + var i_553648588 = 0; + var colontmp__553649331 = 0; + colontmp__553649331 = x_553648537.childNodes.length; + var i_553649332 = 0; + Label13: { + Label14: while (true) { + if (!(i_553649332 < colontmp__553649331)) break Label14; + i_553648588 = i_553649332; + if (!(isWhitespace_553648533(x_553648537.childNodes[i_553648588]))) { + idx_553648583.push(i_553648588);; + } + + i_553649332 = addInt(i_553649332, 1); + } + }; + }; + if (!((idx_553648583).length == 2)) Temporary15 = false; else { Temporary15 = (x_553648537.childNodes[idx_553648583[chckIndx(1, 0, (idx_553648583).length - 1)]].nodeName == "UL"); } if (Temporary15) { + var e_553648604 = {heading: x_553648537.childNodes[idx_553648583[chckIndx(0, 0, (idx_553648583).length - 1)]], kids: [], sortId: (father_553648538.kids).length, doSort: false}; + var it_553648605 = x_553648537.childNodes[idx_553648583[chckIndx(1, 0, (idx_553648583).length - 1)]]; + Label16: { + var j_553648610 = 0; + var colontmp__553649335 = 0; + colontmp__553649335 = it_553648605.childNodes.length; + var i_553649336 = 0; + Label17: { + Label18: while (true) { + if (!(i_553649336 < colontmp__553649335)) break Label18; + j_553648610 = i_553649336; + toToc_553648536(it_553648605.childNodes[j_553648610], e_553648604); + i_553649336 = addInt(i_553649336, 1); + } + }; + }; + father_553648538.kids.push(e_553648604);; + } + else { + Label19: { + var i_553648619 = 0; + var colontmp__553649339 = 0; + colontmp__553649339 = x_553648537.childNodes.length; + var i_553649340 = 0; + Label20: { + Label21: while (true) { + if (!(i_553649340 < colontmp__553649339)) break Label21; + i_553648619 = i_553649340; + toToc_553648536(x_553648537.childNodes[i_553648619], father_553648538); + i_553649340 = addInt(i_553649340, 1); + } + }; + }; + } + + } + else { + father_553648538.kids.push({heading: x_553648537, kids: [], sortId: (father_553648538.kids).length, doSort: false});; + } + }} + + +} + +function extractItems_553648325(x_553648326, heading_553648327, items_553648328, items_553648328_Idx) { + BeforeRet: { + if ((x_553648326 == null)) { + break BeforeRet; + } + + if ((!((x_553648326.heading == null)) && (x_553648326.heading.textContent == heading_553648327))) { + Label1: { + var i_553648345 = 0; + var colontmp__553649343 = 0; + colontmp__553649343 = (x_553648326.kids).length; + var i_553649344 = 0; + Label2: { + Label3: while (true) { + if (!(i_553649344 < colontmp__553649343)) break Label3; + i_553648345 = i_553649344; + items_553648328[items_553648328_Idx].push(x_553648326.kids[chckIndx(i_553648345, 0, (x_553648326.kids).length - 1)].heading);; + i_553649344 = addInt(i_553649344, 1); + } + }; + }; + } + else { + Label4: { + var k_553648370 = null; + var i_553649348 = 0; + var L_553649349 = (x_553648326.kids).length; + Label5: { + Label6: while (true) { + if (!(i_553649348 < L_553649349)) break Label6; + k_553648370 = x_553648326.kids[chckIndx(i_553649348, 0, (x_553648326.kids).length - 1)]; + extractItems_553648325(k_553648370, heading_553648327, items_553648328, items_553648328_Idx); + i_553649348 += 1; + if (!(((x_553648326.kids).length == L_553649349))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + } + + }; + + +} + +function tree_553648257(tag_553648258, kids_553648259) { + var result_553648260 = null; + + result_553648260 = document.createElement(tag_553648258); + Label1: { + var k_553648273 = null; + var i_553649361 = 0; + Label2: { + Label3: while (true) { + if (!(i_553649361 < (kids_553648259).length)) break Label3; + k_553648273 = kids_553648259[chckIndx(i_553649361, 0, (kids_553648259).length - 1)]; + result_553648260.appendChild(k_553648273); + i_553649361 += 1; + } + }; + }; + + return result_553648260; + +} + +function text_553648281(s_553648282) { + var result_553648283 = null; + + result_553648283 = document.createTextNode(s_553648282); + + return result_553648283; + +} + +function uncovered_553648723(x_553648724) { + var Temporary1; + + var result_553648725 = null; + + BeforeRet: { + if ((((x_553648724.kids).length == 0) && !((x_553648724.heading == null)))) { + if (!(x_553648724.heading.hasOwnProperty('__karaxMarker__'))) { + Temporary1 = x_553648724; + } + else { + Temporary1 = null; + } + + result_553648725 = Temporary1; + break BeforeRet; + } + + result_553648725 = {heading: x_553648724.heading, kids: [], sortId: x_553648724.sortId, doSort: x_553648724.doSort}; + Label2: { + var k_553648740 = null; + var i_553649368 = 0; + var L_553649369 = (x_553648724.kids).length; + Label3: { + Label4: while (true) { + if (!(i_553649368 < L_553649369)) break Label4; + k_553648740 = x_553648724.kids[chckIndx(i_553649368, 0, (x_553648724.kids).length - 1)]; + var y_553648741 = uncovered_553648723(k_553648740); + if (!((y_553648741 == null))) { + result_553648725.kids.push(y_553648741);; + } + + i_553649368 += 1; + if (!(((x_553648724.kids).length == L_553649369))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + if (((result_553648725.kids).length == 0)) { + result_553648725 = null; + } + + }; + + return result_553648725; + +} + +function mergeTocs_553648753(orig_553648754, news_553648755) { + var result_553648756 = null; + + result_553648756 = uncovered_553648723(orig_553648754); + if ((result_553648756 == null)) { + result_553648756 = news_553648755; + } + else { + Label1: { + var i_553648768 = 0; + var colontmp__553649364 = 0; + colontmp__553649364 = (news_553648755.kids).length; + var i_553649365 = 0; + Label2: { + Label3: while (true) { + if (!(i_553649365 < colontmp__553649364)) break Label3; + i_553648768 = i_553649365; + result_553648756.kids.push(news_553648755.kids[chckIndx(i_553648768, 0, (news_553648755.kids).length - 1)]);; + i_553649365 = addInt(i_553649365, 1); + } + }; + }; + } + + + return result_553648756; + +} + +function buildToc_553648773(orig_553648774, types_553648775, procs_553648776) { + var result_553648777 = null; + + var newStuff_553648782 = {heading: null, kids: [], doSort: true, sortId: 0}; + Label1: { + var t_553648786 = null; + var i_553649356 = 0; + var L_553649357 = (types_553648775).length; + Label2: { + Label3: while (true) { + if (!(i_553649356 < L_553649357)) break Label3; + t_553648786 = types_553648775[chckIndx(i_553649356, 0, (types_553648775).length - 1)]; + var c_553648791 = {heading: t_553648786.cloneNode(true), kids: [], doSort: true, sortId: 0}; + t_553648786.__karaxMarker__ = true; + Label4: { + var p_553648795 = null; + var i_553649353 = 0; + var L_553649354 = (procs_553648776).length; + Label5: { + Label6: while (true) { + if (!(i_553649353 < L_553649354)) break Label6; + p_553648795 = procs_553648776[chckIndx(i_553649353, 0, (procs_553648776).length - 1)]; + if (!(p_553648795.hasOwnProperty('__karaxMarker__'))) { + var xx_553648796 = p_553648795.parentNode.getElementsByClassName("attachedType"); + if ((((xx_553648796).length == 1) && (xx_553648796[chckIndx(0, 0, (xx_553648796).length - 1)].textContent == t_553648786.textContent))) { + var q_553648801 = tree_553648257("A", [text_553648281(p_553648795.title)]); + q_553648801.setAttribute("href", p_553648795.getAttribute("href")); + c_553648791.kids.push({heading: q_553648801, kids: [], sortId: 0, doSort: false});; + p_553648795.__karaxMarker__ = true; + } + + } + + i_553649353 += 1; + if (!(((procs_553648776).length == L_553649354))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + newStuff_553648782.kids.push(c_553648791);; + i_553649356 += 1; + if (!(((types_553648775).length == L_553649357))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + result_553648777 = mergeTocs_553648753(orig_553648774, newStuff_553648782); + + return result_553648777; + +} + +function add_553648274(parent_553648275, kid_553648276) { + if (((parent_553648275.nodeName == "TR") && ((kid_553648276.nodeName == "TD") || (kid_553648276.nodeName == "TH")))) { + var k_553648277 = document.createElement("TD"); + k_553648277.appendChild(kid_553648276); + parent_553648275.appendChild(k_553648277); + } + else { + parent_553648275.appendChild(kid_553648276); + } + + + +} + +function setClass_553648278(e_553648279, value_553648280) { + e_553648279.setAttribute("class", value_553648280); + + +} + +function toHtml_553648403(x_553648404, isRoot_553648405) { + +function HEX3Aanonymous_553648423(a_553648424, b_553648425) { + var result_553648426 = 0; + + BeforeRet: { + if ((!((a_553648424.heading == null)) && !((b_553648425.heading == null)))) { + var x_553648435 = a_553648424.heading.textContent; + var y_553648436 = b_553648425.heading.textContent; + if ((x_553648435 < y_553648436)) { + result_553648426 = (-1); + break BeforeRet; + } + + if ((y_553648436 < x_553648435)) { + result_553648426 = 1; + break BeforeRet; + } + + result_553648426 = 0; + break BeforeRet; + } + else { + result_553648426 = subInt(a_553648424.sortId, b_553648425.sortId); + break BeforeRet; + } + + }; + + return result_553648426; + + } + + var result_553648406 = null; + + BeforeRet: { + if ((x_553648404 == null)) { + result_553648406 = null; + break BeforeRet; + } + + if (((x_553648404.kids).length == 0)) { + if ((x_553648404.heading == null)) { + result_553648406 = null; + break BeforeRet; + } + + result_553648406 = x_553648404.heading.cloneNode(true); + break BeforeRet; + } + + result_553648406 = tree_553648257("DIV", []); + if ((!((x_553648404.heading == null)) && !(x_553648404.heading.hasOwnProperty('__karaxMarker__')))) { + add_553648274(result_553648406, x_553648404.heading.cloneNode(true)); + } + + var ul_553648422 = tree_553648257("UL", []); + if (isRoot_553648405) { + setClass_553648278(ul_553648422, "simple simple-toc"); + } + else { + setClass_553648278(ul_553648422, "simple"); + } + + if (x_553648404.doSort) { + x_553648404.kids.sort(HEX3Aanonymous_553648423); + } + + Label1: { + var k_553648448 = null; + var i_553649372 = 0; + var L_553649373 = (x_553648404.kids).length; + Label2: { + Label3: while (true) { + if (!(i_553649372 < L_553649373)) break Label3; + k_553648448 = x_553648404.kids[chckIndx(i_553649372, 0, (x_553648404.kids).length - 1)]; + var y_553648449 = toHtml_553648403(k_553648448, false); + if (!((y_553648449 == null))) { + add_553648274(ul_553648422, tree_553648257("LI", [y_553648449])); + } + + i_553649372 += 1; + if (!(((x_553648404.kids).length == L_553649373))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + if (!((ul_553648422.childNodes.length == 0))) { + add_553648274(result_553648406, ul_553648422); + } + + if ((result_553648406.childNodes.length == 0)) { + result_553648406 = null; + } + + }; + + return result_553648406; + +} + +function replaceById_553648284(id_553648285, newTree_553648286) { + var x_553648287 = document.getElementById(id_553648285); + x_553648287.parentNode.replaceChild(newTree_553648286, x_553648287); + newTree_553648286.id = id_553648285; + + +} + +function togglevis_553648831(d_553648832) { + if ((d_553648832.style.display == "none")) { + d_553648832.style.display = "inline"; + } + else { + d_553648832.style.display = "none"; + } + + + +} + +function groupBy(value_553648834) { + var toc_553648835 = document.getElementById("toc-list"); + if ((alternative_553648830[0] == null)) { + var tt_553648843 = {heading: null, kids: [], sortId: 0, doSort: false}; + toToc_553648536(toc_553648835, tt_553648843); + tt_553648843 = tt_553648843.kids[chckIndx(0, 0, (tt_553648843.kids).length - 1)]; + var types_553648848 = [[]]; + var procs_553648853 = [[]]; + extractItems_553648325(tt_553648843, "Types", types_553648848, 0); + extractItems_553648325(tt_553648843, "Procs", procs_553648853, 0); + extractItems_553648325(tt_553648843, "Converters", procs_553648853, 0); + extractItems_553648325(tt_553648843, "Methods", procs_553648853, 0); + extractItems_553648325(tt_553648843, "Templates", procs_553648853, 0); + extractItems_553648325(tt_553648843, "Macros", procs_553648853, 0); + extractItems_553648325(tt_553648843, "Iterators", procs_553648853, 0); + var ntoc_553648854 = buildToc_553648773(tt_553648843, types_553648848[0], procs_553648853[0]); + var x_553648855 = toHtml_553648403(ntoc_553648854, true); + alternative_553648830[0] = tree_553648257("DIV", [x_553648855]); + } + + if ((value_553648834 == "type")) { + replaceById_553648284("tocRoot", alternative_553648830[0]); + } + else { + replaceById_553648284("tocRoot", tree_553648257("DIV", [])); + } + + togglevis_553648831(document.getElementById("toc-list")); + + +} + +function HEX5BHEX5D_721421547(s_721421550, x_721421551) { + var result_721421552 = []; + + var a_721421554 = x_721421551.a; + var L_721421556 = addInt(subInt(subInt((s_721421550).length, x_721421551.b), a_721421554), 1); + result_721421552 = nimCopy(null, mnewString(chckRange(L_721421556, 0, 2147483647)), NTI33554449); + Label1: { + var i_721421561 = 0; + var i_553649382 = 0; + Label2: { + Label3: while (true) { + if (!(i_553649382 < L_721421556)) break Label3; + i_721421561 = i_553649382; + result_721421552[chckIndx(i_721421561, 0, (result_721421552).length - 1)] = s_721421550[chckIndx(addInt(i_721421561, a_721421554), 0, (s_721421550).length - 1)]; + i_553649382 = addInt(i_553649382, 1); + } + }; + }; + + return result_721421552; + +} + +function HEX2EHEX2E_939524199(a_939524202, b_939524203) { + var result_939524206 = ({a: 0, b: 0}); + + result_939524206 = nimCopy(result_939524206, {a: a_939524202, b: b_939524203}, NTI939524179); + + return result_939524206; + +} +async function loadIndex_553649049() { + var result_553649051 = null; + + BeforeRet: { + var indexURL_553649057 = document.getElementById("indexLink").getAttribute("href"); + var rootURL_553649082 = HEX5BHEX5D_721421547(cstrToNimstr(indexURL_553649057), HEX2EHEX2E_939524199(0, 14)); + var resp_553649094 = (await (await fetch(indexURL_553649057)).text()); + var indexElem_553649095 = document.createElement("div"); + indexElem_553649095.innerHTML = resp_553649094; + Label1: { + var href_553649116 = null; + var colontmp__553649376 = []; + colontmp__553649376 = indexElem_553649095.getElementsByClassName("reference"); + var i_553649378 = 0; + var L_553649379 = (colontmp__553649376).length; + Label2: { + Label3: while (true) { + if (!(i_553649378 < L_553649379)) break Label3; + href_553649116 = colontmp__553649376[chckIndx(i_553649378, 0, (colontmp__553649376).length - 1)]; + href_553649116.setAttribute("href", toJSStr((rootURL_553649082 || []).concat(cstrToNimstr(href_553649116.getAttribute("href")) || []))); + db_553648872[0].push(href_553649116);; + contents_553648873[0].push(href_553649116.getAttribute("data-doc-search-tag"));; + i_553649378 += 1; + if (!(((colontmp__553649376).length == L_553649379))) { + failedAssertImpl_268435541(makeNimstrLit("iterators.nim(251, 11) `len(a) == L` the length of the seq changed while iterating over it")); + } + + } + }; + }; + result_553649051 = undefined; + break BeforeRet; + }; + + return result_553649051; + +} + +function then_553649225(future_553649228, onSuccess_553649229, onReject_553649230) { + var result_553649231 = null; + + BeforeRet: { + var ret_553649241 = null; + ret_553649241 = future_553649228.then(onSuccess_553649229, onReject_553649230) + result_553649231 = ret_553649241; + break BeforeRet; + }; + + return result_553649231; + +} + +function nsuToLowerAsciiChar(c_721420373) { + var result_721420374 = 0; + + if ((ConstSet2[c_721420373] != undefined)) { + result_721420374 = (c_721420373 ^ 32); + } + else { + result_721420374 = c_721420373; + } + + + return result_721420374; + +} + +function fuzzyMatch_704643088(pattern_704643089, str_704643090) { + var Temporary4; + var Temporary5; + var Temporary6; + var Temporary7; + var Temporary8; + + var result_704643093 = {Field0: 0, Field1: false}; + + var scoreState_704643094 = (-100); + var headerMatched_704643095 = false; + var unmatchedLeadingCharCount_704643096 = 0; + var consecutiveMatchCount_704643097 = 0; + var strIndex_704643098 = 0; + var patIndex_704643099 = 0; + var score_704643100 = 0; + Label1: { + Label2: while (true) { + if (!((strIndex_704643098 < ((str_704643090) == null ? 0 : (str_704643090).length)) && (patIndex_704643099 < ((pattern_704643089) == null ? 0 : (pattern_704643089).length)))) break Label2; + Label3: { + var patternChar_704643103 = nsuToLowerAsciiChar(pattern_704643089.charCodeAt(chckIndx(patIndex_704643099, 0, (pattern_704643089).length - 1))); + var strChar_704643104 = nsuToLowerAsciiChar(str_704643090.charCodeAt(chckIndx(strIndex_704643098, 0, (str_704643090).length - 1))); + if ((ConstSet3[patternChar_704643103] != undefined)) { + patIndex_704643099 = addInt(patIndex_704643099, 1); + break Label3; + } + + if ((ConstSet4[strChar_704643104] != undefined)) { + strIndex_704643098 = addInt(strIndex_704643098, 1); + break Label3; + } + + if ((!(headerMatched_704643095) && (strChar_704643104 == 58))) { + headerMatched_704643095 = true; + scoreState_704643094 = (-100); + score_704643100 = ((Math.floor((0.5 * score_704643100))) | 0); + patIndex_704643099 = 0; + strIndex_704643098 = addInt(strIndex_704643098, 1); + break Label3; + } + + if ((strChar_704643104 == patternChar_704643103)) { + switch (scoreState_704643094) { + case (-100): + case 20: + scoreState_704643094 = 10; + break; + case 0: + scoreState_704643094 = 5; + score_704643100 = addInt(score_704643100, scoreState_704643094); + break; + case 10: + case 5: + consecutiveMatchCount_704643097 = addInt(consecutiveMatchCount_704643097, 1); + scoreState_704643094 = 5; + score_704643100 = addInt(score_704643100, mulInt(5, consecutiveMatchCount_704643097)); + if ((scoreState_704643094 == 10)) { + score_704643100 = addInt(score_704643100, 10); + } + + var onBoundary_704643156 = (patIndex_704643099 == ((pattern_704643089) == null ? -1 : (pattern_704643089).length - 1)); + if ((!(onBoundary_704643156) && (strIndex_704643098 < ((str_704643090) == null ? -1 : (str_704643090).length - 1)))) { + var nextPatternChar_704643157 = nsuToLowerAsciiChar(pattern_704643089.charCodeAt(chckIndx(addInt(patIndex_704643099, 1), 0, (pattern_704643089).length - 1))); + var nextStrChar_704643158 = nsuToLowerAsciiChar(str_704643090.charCodeAt(chckIndx(addInt(strIndex_704643098, 1), 0, (str_704643090).length - 1))); + if (!!((ConstSet5[nextStrChar_704643158] != undefined))) Temporary4 = false; else { Temporary4 = !((nextStrChar_704643158 == nextPatternChar_704643157)); } onBoundary_704643156 = Temporary4; + } + + if (onBoundary_704643156) { + scoreState_704643094 = 20; + score_704643100 = addInt(score_704643100, scoreState_704643094); + } + + break; + case (-1): + case (-3): + if (!((ConstSet6[str_704643090.charCodeAt(chckIndx(subInt(strIndex_704643098, 1), 0, (str_704643090).length - 1))] != undefined))) Temporary5 = true; else { if (!(ConstSet7[str_704643090.charCodeAt(chckIndx(subInt(strIndex_704643098, 1), 0, (str_704643090).length - 1))] != undefined)) Temporary6 = false; else { Temporary6 = (ConstSet8[str_704643090.charCodeAt(chckIndx(strIndex_704643098, 0, (str_704643090).length - 1))] != undefined); } Temporary5 = Temporary6; } var isLeadingChar_704643182 = Temporary5; + if (isLeadingChar_704643182) { + scoreState_704643094 = 10; + } + else { + scoreState_704643094 = 0; + score_704643100 = addInt(score_704643100, scoreState_704643094); + } + + break; + } + patIndex_704643099 = addInt(patIndex_704643099, 1); + } + else { + switch (scoreState_704643094) { + case (-100): + scoreState_704643094 = (-3); + score_704643100 = addInt(score_704643100, scoreState_704643094); + break; + case 5: + scoreState_704643094 = (-1); + score_704643100 = addInt(score_704643100, scoreState_704643094); + consecutiveMatchCount_704643097 = 0; + break; + case (-3): + if ((unmatchedLeadingCharCount_704643096 < 3)) { + scoreState_704643094 = (-3); + score_704643100 = addInt(score_704643100, scoreState_704643094); + } + + unmatchedLeadingCharCount_704643096 = addInt(unmatchedLeadingCharCount_704643096, 1); + break; + default: + scoreState_704643094 = (-1); + score_704643100 = addInt(score_704643100, scoreState_704643094); + break; + } + } + + strIndex_704643098 = addInt(strIndex_704643098, 1); + }; + } + }; + if (!(patIndex_704643099 == ((pattern_704643089) == null ? 0 : (pattern_704643089).length))) Temporary7 = false; else { if ((strIndex_704643098 == ((str_704643090) == null ? 0 : (str_704643090).length))) Temporary8 = true; else { Temporary8 = !((ConstSet9[str_704643090.charCodeAt(chckIndx(strIndex_704643098, 0, (str_704643090).length - 1))] != undefined)); } Temporary7 = Temporary8; } if (Temporary7) { + score_704643100 = addInt(score_704643100, 10); + } + + var colontmp__553649395 = nimMax(0, score_704643100); + var colontmp__553649396 = (0 < score_704643100); + result_704643093 = nimCopy(result_704643093, {Field0: colontmp__553649395, Field1: colontmp__553649396}, NTI704643086); + + return result_704643093; + +} + +function escapeCString_553648874(x_553648875, x_553648875_Idx) { + var s_553648876 = []; + Label1: { + var c_553648877 = 0; + var iHEX60gensym12_553649399 = 0; + var nHEX60gensym12_553649400 = ((x_553648875[x_553648875_Idx]) == null ? 0 : (x_553648875[x_553648875_Idx]).length); + Label2: { + Label3: while (true) { + if (!(iHEX60gensym12_553649399 < nHEX60gensym12_553649400)) break Label3; + c_553648877 = x_553648875[x_553648875_Idx].charCodeAt(chckIndx(iHEX60gensym12_553649399, 0, (x_553648875[x_553648875_Idx]).length - 1)); + switch (c_553648877) { + case 60: + s_553648876.push.apply(s_553648876, [38,108,116,59]);; + break; + case 62: + s_553648876.push.apply(s_553648876, [38,103,116,59]);; + break; + default: + addChar(s_553648876, c_553648877);; + break; + } + iHEX60gensym12_553649399 += 1; + } + }; + }; + x_553648875[x_553648875_Idx] = toJSStr(s_553648876); + + +} + +function dosearch_553648878(value_553648879) { + +function HEX3Aanonymous_553648906(a_553648911, b_553648912) { + var result_553648917 = 0; + + result_553648917 = subInt(b_553648912["Field1"], a_553648911["Field1"]); + + return result_553648917; + + } + + var result_553648880 = null; + + BeforeRet: { + if (((db_553648872[0]).length == 0)) { + break BeforeRet; + } + + var ul_553648884 = tree_553648257("UL", []); + result_553648880 = tree_553648257("DIV", []); + setClass_553648278(result_553648880, "search_results"); + var matches_553648889 = []; + Label1: { + var i_553648897 = 0; + var colontmp__553649386 = 0; + colontmp__553649386 = (db_553648872[0]).length; + var i_553649387 = 0; + Label2: { + Label3: while (true) { + if (!(i_553649387 < colontmp__553649386)) break Label3; + i_553648897 = i_553649387; + Label4: { + var c_553648898 = contents_553648873[0][chckIndx(i_553648897, 0, (contents_553648873[0]).length - 1)]; + if (((c_553648898 == "Examples") || (c_553648898 == "PEG construction"))) { + break Label4; + } + + var tmpTuple_553648899 = fuzzyMatch_704643088(value_553648879, c_553648898); + var score_553648900 = tmpTuple_553648899["Field0"]; + var matched_553648901 = tmpTuple_553648899["Field1"]; + if (matched_553648901) { + matches_553648889.push({Field0: db_553648872[0][chckIndx(i_553648897, 0, (db_553648872[0]).length - 1)], Field1: score_553648900});; + } + + }; + i_553649387 = addInt(i_553649387, 1); + } + }; + }; + matches_553648889.sort(HEX3Aanonymous_553648906); + Label5: { + var i_553648934 = 0; + var colontmp__553649390 = 0; + colontmp__553649390 = nimMin((matches_553648889).length, 29); + var i_553649391 = 0; + Label6: { + Label7: while (true) { + if (!(i_553649391 < colontmp__553649390)) break Label7; + i_553648934 = i_553649391; + matches_553648889[chckIndx(i_553648934, 0, (matches_553648889).length - 1)]["Field0"].innerHTML = matches_553648889[chckIndx(i_553648934, 0, (matches_553648889).length - 1)]["Field0"].getAttribute("data-doc-search-tag"); + escapeCString_553648874(matches_553648889[chckIndx(i_553648934, 0, (matches_553648889).length - 1)]["Field0"], "innerHTML"); + add_553648274(ul_553648884, tree_553648257("LI", [matches_553648889[chckIndx(i_553648934, 0, (matches_553648889).length - 1)]["Field0"]])); + i_553649391 = addInt(i_553649391, 1); + } + }; + }; + if ((ul_553648884.childNodes.length == 0)) { + add_553648274(result_553648880, tree_553648257("B", [text_553648281("no search results")])); + } + else { + add_553648274(result_553648880, tree_553648257("B", [text_553648281("search results")])); + add_553648274(result_553648880, ul_553648884); + } + + }; + + return result_553648880; + +} + +function search() { + +function wrapper_553649210() { + var elem_553649211 = document.getElementById("searchInput"); + var value_553649212 = elem_553649211.value; + if (!((((value_553649212) == null ? 0 : (value_553649212).length) == 0))) { + if ((oldtoc_553649205[0] == null)) { + oldtoc_553649205[0] = document.getElementById("tocRoot"); + } + + var results_553649216 = dosearch_553648878(value_553649212); + replaceById_553648284("tocRoot", results_553649216); + } + else { + if (!((oldtoc_553649205[0] == null))) { + replaceById_553648284("tocRoot", oldtoc_553649205[0]); + } + } + + + } + + if ((loadIndexFut_553649208[0] == null)) { + loadIndexFut_553649208[0] = loadIndex_553649049(); + var _ = then_553649225(loadIndexFut_553649208[0], wrapper_553649210, null); + } + + if (!((timer_553649206[0] == null))) { + clearTimeout(timer_553649206[0]); + } + + timer_553649206[0] = setTimeout(wrapper_553649210, 400); + + +} + +function copyToClipboard() { + + function updatePreTags() { + + const allPreTags = document.querySelectorAll("pre") + + allPreTags.forEach((e) => { + + const div = document.createElement("div") + div.classList.add("copyToClipBoard") + + const preTag = document.createElement("pre") + preTag.innerHTML = e.innerHTML + + const button = document.createElement("button") + button.value = e.textContent.replace('...', '') + button.classList.add("copyToClipBoardBtn") + button.style.cursor = "pointer" + + div.appendChild(preTag) + div.appendChild(button) + + e.outerHTML = div.outerHTML + + }) + } + + + function copyTextToClipboard(e) { + const clipBoardContent = e.target.value + navigator.clipboard.writeText(clipBoardContent).then(function() { + e.target.style.setProperty("--clipboard-image", "var(--clipboard-image-selected)") + }, function(err) { + console.error("Could not copy text: ", err); + }); + } + + window.addEventListener("click", (e) => { + if (e.target.classList.contains("copyToClipBoardBtn")) { + copyTextToClipboard(e) + } + }) + + window.addEventListener("mouseover", (e) => { + if (e.target.nodeName === "PRE") { + e.target.nextElementSibling.style.setProperty("--clipboard-image", "var(--clipboard-image-normal)") + } + }) + + window.addEventListener("DOMContentLoaded", updatePreTags) + + + + +} +var Temporary1; +var t_553648167 = window.localStorage.getItem("theme"); +if ((t_553648167 == null)) { +Temporary1 = "auto"; +} +else { +Temporary1 = t_553648167; +} + +setTheme(Temporary1); +var alternative_553648830 = [null]; +var db_553648872 = [[]]; +var contents_553648873 = [[]]; +var oldtoc_553649205 = [null]; +var timer_553649206 = [null]; +var loadIndexFut_553649208 = [null]; +copyToClipboard(); +window.addEventListener("DOMContentLoaded", onDOMLoaded, false); diff --git a/index.html b/index.html new file mode 100644 index 00000000..7803b823 --- /dev/null +++ b/index.html @@ -0,0 +1,1738 @@ + + + + + + + +Index + + + + + + + + + + + + +
+
+

Index

+ Modules: cps, cps/defers, cps/environment, cps/exprs, cps/help, cps/hooks, cps/normalizedast, cps/returns, cps/rewrites, cps/spec, cps/transform.

API symbols

+
`$`:
+
`()`:
+
`==`:
+
`[]=`:
+
`[]`:
+
AccessNodes:
+
add:
+
addInitializationToDefault:
+
addPragma:
+
alloc:
+
Alloc:
+
asCall:
+
asCallKind:
+
asConv:
+
asIdentDefs:
+
asName:
+
asNameAllowEmpty:
+
asPragmaAtom:
+
asPragmaBlock:
+
asPragmaStmt:
+
asProcDef:
+
asRoutineDef:
+
assignTo:
+
asSym:
+
asTypeDef:
+
asTypeExpr:
+
asTypeExprAllowEmpty:
+
asTypeExprObj:
+
asTypeExprRef:
+
asTypeSection:
+
asVarLet:
+
asVarLetIdentDef:
+
asVarLetTuple:
+
bindName:
+
body:
+
body=:
+
boot:
+
Boot:
+
bootstrapSymbol:
+
breakLabel:
+
CachePair:
+
Call:
+
call:
+
Callback:
+
callingParams:
+
CallKind:
+
cCallToNormNode:
+
cConvToNormNode:
+
cDefVarLetToNormNode:
+
cFormalParamsToNormNode:
+
childCallToRecoverResult:
+
cIdentDefLetToIdentDef:
+
cIdentDefLetToNormNode:
+
cIdentDefToNimNode:
+
cIdentDefToNormNode:
+
cIdentDefVarToIdentDef:
+
cIdentToNimNode:
+
cLetIdentDefToVarLetIdentDef:
+
cLetSectionToNormNode:
+
clone:
+
cNameToNormNode:
+
cNormNodeToNimNode:
+
colon:
+
comments:
+
ConstructNodes:
+
Continuation:
+
ContinuationObj:
+
ContinuationProc:
+
Conv:
+
ConvNodes:
+
coop:
+
Coop:
+
copy:
+
copyLineInfo:
+
copyNimNode:
+
copyNimTree:
+
copyNodeAndTransformIt:
+
copyOrVoid:
+
cPragmaAtomToNormNode:
+
cPragmaStmtToNormNode:
+
cProcDefToNormNode:
+
cProcDefToRoutineDef:
+
cps:
+
cpsBootstrap:
+
cpsBreak:
+
cpsCall:
+
cpsCallback:
+
cpsCallbackShim:
+
cpsCallbackTypeDef:
+
cpsCallOperatorSupported:
+
cpsCont:
+
cpsContinue:
+
cpsDebug:
+
cpsEnvironment:
+
cpsFlattenExpr:
+
cpsHasException:
+
cpsLift:
+
cpsMagic:
+
cpsMagicCall:
+
cpsMustJump:
+
cpsPending:
+
cpsResult:
+
cpsReturnType:
+
cpsStackFrames:
+
cpsTerminate:
+
cpsTraceDeque:
+
cpsTransform:
+
cpsVoodoo:
+
cpsVoodooCall:
+
createBootstrap:
+
createCallback:
+
createCallbackShim:
+
createContinuation:
+
createRecover:
+
createWhelp:
+
cRoutineDefToNimNode:
+
cRoutineDefToNormNode:
+
cRoutineParamToIdentDef:
+
cRoutineParamToNormNode:
+
cSymToName:
+
cSymToNormNode:
+
cTypeExprRefToTypeExpr:
+
cTypeExprToNormNode:
+
cVarIdentDefToVarLetIdentDef:
+
cVarLetIdentDefToNormNode:
+
cVarLetToNormNode:
+
cVarLetTupleToNormNode:
+
cVarSectionToNimNode:
+
cVarSectionToNormNode:
+
dealloc:
+
Dealloc:
+
debug:
+
debugAnnotation:
+
def:
+
DefLike:
+
desym:
+
disarm:
+
dismiss:
+
dismissed:
+
doc:
+
dot:
+
DotExpr:
+
emptyAsNil:
+
enbasen:
+
ensimilate:
+
Env:
+
eq:
+
eqIdent:
+
errorAst:
+
errorGot:
+
etype:
+
expr:
+
ExprLike:
+
filter:
+
filterPragma:
+
findChild:
+
findChildRecursive:
+
findColonLit:
+
finished:
+
first:
+
firstCallParam:
+
firstDef:
+
firstReturn:
+
FormalParams:
+
formalParams:
+
formalParams=:
+
genException:
+
genField:
+
genProcName:
+
genSymField:
+
genSymLet:
+
genSymProc:
+
genSymType:
+
genSymUnknown:
+
genSymVar:
+
genTypeName:
+
getContSym:
+
getImpl:
+
getPragmaName:
+
getResult:
+
getTypeInst:
+
hash:
+
hasImpl:
+
hasPragma:
+
hasType:
+
hasValue:
+
head:
+
Head:
+
HiddenNodes:
+
hook:
+
Hook:
+
Ident:
+
IdentDef:
+
identdef:
+
IdentDefLet:
+
IdentDefLike:
+
IdentDefVar:
+
IdentDefVarLet:
+
identity:
+
ifCallKindThenIt:
+
ifCallThenIt:
+
impl:
+
indexNamePairs:
+
inferTypFromImpl:
+
inherits:
+
initFrame:
+
introduce:
+
isCpsBlock:
+
isCpsBreak:
+
isCpsCall:
+
isCpsCont:
+
isCpsContinue:
+
isCpsConvCall:
+
isCpsPending:
+
isCpsTerminate:
+
isDirty:
+
isEmpty:
+
isExported:
+
isNil:
+
isNotNil:
+
isScopeExit:
+
isSymbol:
+
isTuple:
+
isVoodooCall:
+
items:
+
jumperCall:
+
kind:
+
last:
+
len:
+
LetIdentDef:
+
LetSection:
+
LetSectionLike:
+
lineAndFile:
+
localSection:
+
makeErrorShim:
+
makeLineInfo:
+
makeReturn:
+
makeType:
+
matchCpsBreak:
+
Matcher:
+
maybeConvertToRoot:
+
multiReplace:
+
Name:
+
name:
+
name=:
+
nameForNode:
+
newAssignment:
+
newCall:
+
newColonExpr:
+
newCpsBreak:
+
newCpsContinue:
+
newCpsPending:
+
newCpsTerminate:
+
newDotExpr:
+
newEmptyNormNode:
+
newEnv:
+
newFormalParams:
+
newIdentDef:
+
newIdentDefVar:
+
newLetIdentDef:
+
newNodeAndTransformIt:
+
newPragmaColonExpr:
+
newPragmaStmt:
+
newPragmaStmtWithInfo:
+
newProcDef:
+
newRefType:
+
newStmtList:
+
newTree:
+
newVarIdentDef:
+
newVarLetIdentDef:
+
newVarSection:
+
nilAsEmpty:
+
NilNimNode:
+
NilNormNode:
+
NodeFilter:
+
NormalCallNodes:
+
normalizeCall:
+
normalizeProcDef:
+
NormalizingFilter:
+
normalizingRewrites:
+
NormFilter:
+
NormMatcher:
+
NormNode:
+
onlyNormalizedNode:
+
pairs:
+
pass:
+
Pass:
+
performUntypedPass:
+
postfix:
+
Pragma:
+
pragma:
+
pragma=:
+
pragmaArgument:
+
PragmaAtom:
+
PragmaBlock:
+
PragmaExpr:
+
PragmaHaver:
+
PragmaLike:
+
PragmaStmt:
+
prependArg:
+
ProcDef:
+
procedure:
+
recover:
+
RecursiveNode:
+
renderStackFrames:
+
renderTraceDeque:
+
replace:
+
replacedSymsWithIdents:
+
resym:
+
returnParam:
+
returnParam=:
+
rewriteCalls:
+
rewriteDefer:
+
rewriteIt:
+
rewriteResult:
+
rewriteReturn:
+
rewriteSymbolsIntoEnvDotField:
+
rewriteVoodoo:
+
root:
+
RoutineDef:
+
RoutineDefLike:
+
RoutineParam:
+
running:
+
sameType:
+
seqNormalizedToSeqNimNode:
+
sinkAnnotated:
+
smartSniffer:
+
stack:
+
Stack:
+
state:
+
State:
+
storeType:
+
stripPragma:
+
strVal:
+
sym:
+
Sym:
+
tail:
+
Tail:
+
tailCall:
+
terminator:
+
trace:
+
Trace:
+
traceDeque:
+
traceDequeSize:
+
TraceFrame:
+
trampoline:
+
trampolineIt:
+
TupleDefVarLet:
+
typ:
+
TypeDef:
+
TypeExpr:
+
TypeExprLike:
+
TypeExprObj:
+
TypeExprRef:
+
typeInst:
+
typeKind:
+
TypeSection:
+
Unwind:
+
unwind:
+
updateLineInfoForContinuationStackFrame:
+
upgradeToNormalizedNode:
+
val:
+
VarIdentDef:
+
VarLet:
+
VarLetIdentDef:
+
VarLetIdentDefLike:
+
VarLetLike:
+
VarLetTuple:
+
VarSection:
+
VarSectionLike:
+
whelp:
+
whelpIt:
+
workaroundRewrites:
+
wrap:
+
wrappedFinally:
+
writeStackFrames:
+
writeTraceDeque:
+
+ +
+
+ + + + + + diff --git a/nimdoc.out.css b/nimdoc.out.css new file mode 100644 index 00000000..a9e4ac9c --- /dev/null +++ b/nimdoc.out.css @@ -0,0 +1,1033 @@ +/* +Stylesheet for use with Docutils/rst2html. + +See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to +customize this style sheet. + +Modified from Chad Skeeters' rst2html-style +https://bitbucket.org/cskeeters/rst2html-style/ + +Modified by Boyd Greenfield and narimiran +*/ + +:root { + --primary-background: #fff; + --secondary-background: ghostwhite; + --third-background: #e8e8e8; + --info-background: #50c050; + --warning-background: #c0a000; + --error-background: #e04040; + --border: #dde; + --text: #222; + --anchor: #07b; + --anchor-focus: #607c9f; + --input-focus: #1fa0eb; + --strong: #3c3c3c; + --hint: #9A9A9A; + --nim-sprite-base64: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAN4AAAA9CAYAAADCt9ebAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFFmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmU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642cRylCx6PeZiuTFScUFxK+f19QovaRS+t4tsasxhvABbZbSfUCV6CM7qtQl6Fm4E1U22UqcAYqvZ42fgJMxH6vdYc5nkBlSW6Pq4fbS6hb6jg0u9yGug7FyS5U1+UcVBbwbFSuMM1sQ1bXK4A9CcviqM0e9H80HdUxCpwIa4McygA/GfgAcCJqmGKKXUixupEv7nHsLc2agWNQ0d9OzC+PHNHIo1XeLCoe8kkqXiUtwKFoWXoEKqk3BpWLaC8cXsV8HT1J+tFTZKvn+DMqFZi1knvtyKg1O2lBHADcCVxEedNSAP4HJcsr0NNWHVUAAAAASUVORK5CYII="); + + --keyword: #5e8f60; + --identifier: #222; + --comment: #484a86; + --operator: #155da4; + --punctuation: black; + --other: black; + --escapeSequence: #c4891b; + --number: #252dbe; + --literal: #a4255b; + --program: #6060c0; + --option: #508000; + --raw-data: #a4255b; + + --clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: black' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E"); + --clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: black' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E"); + --clipboard-image: var(--clipboard-image-normal) +} + +[data-theme="dark"] { + --primary-background: #171921; + --secondary-background: #1e202a; + --third-background: #2b2e3b; + --info-background: #008000; + --warning-background: #807000; + --error-background: #c03000; + --border: #0e1014; + --text: #fff; + --anchor: #8be9fd; + --anchor-focus: #8be9fd; + --input-focus: #8be9fd; + --strong: #bd93f9; + --hint: #7A7C85; + --nim-sprite-base64: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAABMCAYAAABOBlMuAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFFmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjEuMCAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyMDE5LTEyLTAzVDAxOjE4OjIyKzAxOjAwIiB4bXA6TW9kaWZ5RGF0ZT0iMjAxOS0xM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IptPp8HTDL1MwOjoKLS0tUFdXd1IsFudIpdKKgYGB7tloJTrX4MUnsVJTEj9etzY10dHRAQAAGm81wcsZW5CVyQInL69gNCGBjwcAGBx8ANnncypOnTr3H9nn/reD55wovvrQpyIHAHFUzIocGo3mQaPRfBwdHVlubm7bXF1dgcFgABqNNvruglwuh7t374JMJoOOjo7P79y5I+ru7m7q7e1tXQi7MzOh8PIv4pCw2DdaWtte37Au7aPIyCWAxWABjUbPif9HCMbjURtKiaQBfvr5zH9evlJ0uLQ4r/nJMXNiZTIRrMAlJAcHB18HBweWo6Mjy8rKajeJRAJLS0uwtLQECwsLoFAogMfjAYvFgpmZ2XNXMyqVCoaHh2FoaAiGh4cfvwYGBqCvrw+6u7vfvnfvXlNvb29rT09Pq0QsUM7S6c4rNqS/lrZ5U+YPRBKR9M7u9xwqBUUvtNAudH766XSLE8PR49ixE78/8tVnX403Zk7fUR46NUUAIPIPCMdTKJTdNjY2QKPRgE6nA51OB1tbWyCRSIDD4YBAIAAejwcCgfDYUajVakGlUoFarQadTvfY79HX1wf9/f0gl8tBLpfDvXv3HvXw+dxQPYYXMj+d+P7Mmzv+5OHr6/OJWq1GBHeB09TcUiKuq/coKS3/eqIx/wPkiIXC3w6YjAAAAABJRU5ErkJggg=="); + + --keyword: #ff79c6; + --identifier: #f8f8f2; + --comment: #6272a4; + --operator: #ff79c6; + --punctuation: #f8f8f2; + --other: #f8f8f2; + --escapeSequence: #bd93f9; + --number: #bd93f9; + --literal: #f1fa8c; + --program: #9090c0; + --option: #90b010; + --raw-data: #8be9fd; + + --clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E"); + --clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E"); + --clipboard-image: var(--clipboard-image-normal); +} + +@media (prefers-color-scheme: dark) { + [data-theme="auto"] { + --primary-background: #171921; + --secondary-background: #1e202a; + --third-background: #2b2e3b; + --info-background: #008000; + --warning-background: #807000; + --error-background: #c03000; + --border: #0e1014; + --text: #fff; + --anchor: #8be9fd; + --anchor-focus: #8be9fd; + --input-focus: #8be9fd; + --strong: #bd93f9; + --hint: #7A7C85; + --nim-sprite-base64: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARMAAABMCAYAAABOBlMuAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFFmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDggNzkuMTY0MDM2LCAyMDE5LzA4LzEzLTAxOjA2OjU3ICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcm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ABJRU5ErkJggg=="); + + --keyword: #ff79c6; + --identifier: #f8f8f2; + --comment: #6272a4; + --operator: #ff79c6; + --punctuation: #f8f8f2; + --other: #f8f8f2; + --escapeSequence: #bd93f9; + --number: #bd93f9; + --literal: #f1fa8c; + --program: #9090c0; + --option: #90b010; + --raw-data: #8be9fd; + + --clipboard-image-normal: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E %3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2' /%3E %3C/svg%3E"); + --clipboard-image-selected: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' style='color: lightgray' viewBox='0 0 20 20' fill='currentColor'%3E %3Cpath d='M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z' /%3E %3Cpath d='M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z' /%3E %3C/svg%3E"); + --clipboard-image: var(--clipboard-image-normal); + } +} + +.theme-select-wrapper { + display: flex; + align-items: center; +} + +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; } + +body { + font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif; + font-weight: 400; + font-size: 1.125em; + line-height: 1.5; + color: var(--text); + background-color: var(--primary-background); } + +/* Skeleton grid */ +.container { + position: relative; + width: 100%; + max-width: 1050px; + margin: 0 auto; + padding: 0; + box-sizing: border-box; } + +.column, .columns { + width: 100%; + float: left; + box-sizing: border-box; + margin-left: 1%; } + +@media print { + #global-links, .link-seesrc, .theme-switch-wrapper, #searchInputDiv, .search-groupby { + display:none; + } + .columns { + width:100% !important; + } +} + +.column:first-child, .columns:first-child { + margin-left: 0; } + +.container .row { + display: flex; } + +.three.columns { + width: 25.0%; + height: 100vh; + position: sticky; + top: 0px; + overflow-y: auto; + padding: 2px; +} + +.nine.columns { + width: 75.0%; + padding-left: 1.5em; } + +.twelve.columns { + width: 100%; + margin-left: 0; } + +@media screen and (max-width: 860px) { + .three.columns { + display: none; + } + .nine.columns { + width: 98.0%; + } + body { + font-size: 1em; + line-height: 1.35; + } +} + +cite { + font-style: italic !important; } + + +/* Nim search input */ +div#searchInputDiv { + margin-bottom: 1em; +} +input#searchInput { + width: 80%; +} + +/* + * Some custom formatting for input forms. + * This also fixes input form colors on Firefox with a dark system theme on Linux. + */ +input { + -moz-appearance: none; + background-color: var(--secondary-background); + color: var(--text); + border: 1px solid var(--border); + font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif; + font-size: 0.9em; + padding: 6px; +} + +input:focus { + border: 1px solid var(--input-focus); + box-shadow: 0 0 3px var(--input-focus); +} + +select { + -moz-appearance: none; + background-color: var(--secondary-background); + color: var(--text); + border: 1px solid var(--border); + font-family: "Lato", "Helvetica Neue", "HelveticaNeue", Helvetica, Arial, sans-serif; + font-size: 0.9em; + padding: 6px; +} + +select:focus { + border: 1px solid var(--input-focus); + box-shadow: 0 0 3px var(--input-focus); +} + +/* Docgen styles */ + +:target { + border: 2px solid #B5651D; + border-style: dotted; +} + +/* Links */ +a { + color: var(--anchor); + text-decoration: none; +} + +a span.Identifier { + text-decoration: underline; + text-decoration-color: #aab; +} + +a.reference-toplevel { + font-weight: bold; +} + +a.nimdoc { + word-spacing: 0.3em; +} + +a.toc-backref { + text-decoration: none; + color: var(--text); +} + +a.link-seesrc { + color: #607c9f; + font-size: 0.9em; + font-style: italic; +} + +a:hover, a:focus { + color: var(--anchor-focus); + text-decoration: underline; +} + +a:hover span.Identifier { + color: var(--anchor); +} + + +sub, sup { + position: relative; + font-size: 75%; + line-height: 0; + vertical-align: baseline; } + +sup { + top: -0.5em; } + +sub { + bottom: -0.25em; } + +img { + width: auto; + height: auto; + max-width: 100%; + vertical-align: middle; + border: 0; + -ms-interpolation-mode: bicubic; } + +@media print { + * { + color: black !important; + text-shadow: none !important; + background: transparent !important; + box-shadow: none !important; } + + a, a:visited { + text-decoration: underline; } + + a[href]:after { + content: " (" attr(href) ")"; } + + abbr[title]:after { + content: " (" attr(title) ")"; } + + .ir a:after, + a[href^="javascript:"]:after, + a[href^="#"]:after { + content: ""; } + + pre, blockquote { + border: 1px solid #999; + page-break-inside: avoid; } + + thead { + display: table-header-group; } + + tr, img { + page-break-inside: avoid; } + + img { + max-width: 100% !important; } + + @page { + margin: 0.5cm; } + + h1 { + page-break-before: always; } + + h1.title { + page-break-before: avoid; } + + p, h2, h3 { + orphans: 3; + widows: 3; } + + h2, h3 { + page-break-after: avoid; } +} + + +p { + margin-top: 0.5em; + margin-bottom: 0.5em; } + +small { + font-size: 85%; } + +strong { + font-weight: 600; + font-size: 0.95em; + color: var(--strong); } + +em { + font-style: italic; } + +h1 { + font-size: 1.8em; + font-weight: 400; + padding-bottom: .25em; + border-bottom: 6px solid var(--third-background); + margin-top: 2.5em; + margin-bottom: 1em; + line-height: 1.2em; } + +h1.title { + padding-bottom: 1em; + border-bottom: 0px; + font-size: 2.5em; + text-align: center; + font-weight: 900; + margin-top: 0.75em; + margin-bottom: 0em; } + +h2 { + font-size: 1.3em; + margin-top: 2em; } + +h2.subtitle { + margin-top: 0em; + text-align: center; } + +h3 { + font-size: 1.125em; + font-style: italic; + margin-top: 1.5em; } + +h4 { + font-size: 1.125em; + margin-top: 1em; } + +h5 { + font-size: 1.125em; + margin-top: 0.75em; } + +h6 { + font-size: 1.1em; } + + +ul, ol { + padding: 0; + margin-top: 0.5em; + margin-left: 0.75em; } + +ul ul, ul ol, ol ol, ol ul { + margin-bottom: 0; + margin-left: 1.25em; } + +ul.simple > li { + list-style-type: circle; } + +ul.simple-boot li { + list-style-type: none; + margin-left: 0em; + margin-bottom: 0.5em; } + +ol.simple > li, ul.simple > li { + margin-bottom: 0.2em; + margin-left: 0.4em } + +ul.simple.simple-toc > li { + margin-top: 1em; } + +ul.simple-toc { + list-style: none; + font-size: 0.9em; + margin-left: -0.3em; + margin-top: 1em; } + +ul.simple-toc > li { + list-style-type: none; } + +ul.simple-toc-section { + list-style-type: circle; + margin-left: 0.8em; + color: #6c9aae; } + +ul.nested-toc-section { + list-style-type: circle; + margin-left: -0.75em; + color: var(--text); } + +ul.nested-toc-section > li { + margin-left: 1.25em; } + + +ol.arabic { + list-style: decimal; } + +ol.loweralpha { + list-style: lower-alpha; } + +ol.upperalpha { + list-style: upper-alpha; } + +ol.lowerroman { + list-style: lower-roman; } + +ol.upperroman { + list-style: upper-roman; } + +ul.auto-toc { + list-style-type: none; } + + +dl { + margin-bottom: 1.5em; } + +dt { + margin-bottom: -0.5em; + margin-left: 0.0em; } + +dd { + margin-left: 2.0em; + margin-bottom: 3.0em; + margin-top: 0.5em; } + + +hr { + margin: 2em 0; + border: 0; + border-top: 1px solid #aaa; } + +hr.footnote { + width: 25%; + border-top: 0.15em solid #999; + margin-bottom: 0.15em; + margin-top: 0.15em; +} +div.footnote-group { + margin-left: 1em; +} +div.footnote-label { + display: inline-block; + min-width: 1.7em; +} + +div.option-list { + border: 0.1em solid var(--border); +} +div.option-list-item { + padding-left: 12em; + padding-right: 0; + padding-bottom: 0.3em; + padding-top: 0.3em; +} +div.odd { + background-color: var(--secondary-background); +} +div.option-list-label { + margin-left: -11.5em; + margin-right: 0em; + min-width: 11.5em; + display: inline-block; + vertical-align: top; +} +div.option-list-description { + width: calc(100% - 1em); + padding-left: 1em; + padding-right: 0; + display: inline-block; +} + +blockquote { + font-size: 0.9em; + font-style: italic; + padding-left: 0.5em; + margin-left: 0; + border-left: 5px solid #bbc; +} + +blockquote.markdown-quote { + font-size: 0.9rem; /* use rem to avoid recursion */ + font-style: normal; +} + +.pre, span.tok { + font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace; + font-weight: 500; + font-size: 0.85em; + color: var(--text); + background-color: var(--third-background); + padding-left: 3px; + padding-right: 3px; + border-radius: 4px; +} + +span.tok { + border: 1px solid #808080; + padding-bottom: 0.1em; + margin-right: 0.2em; +} + +.copyToClipBoard { + position: relative; +} + +pre { + font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace; + color: var(--text); + font-weight: 500; + display: inline-block; + box-sizing: border-box; + min-width: 100%; + padding: 0.5em; + margin-top: 0.5em; + margin-bottom: 0.5em; + font-size: 0.85em; + white-space: pre !important; + overflow-y: hidden; + overflow-x: visible; + background-color: var(--secondary-background); + border: 1px solid var(--border); + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} + +.copyToClipBoardBtn { + visibility: hidden; + position: absolute; + width: 24px; + border-radius: 4px; + background-image: var(--clipboard-image); + right: 5px; + top: 13px; + background-color: var(--secondary-background); + padding: 11px; + border: 0; +} + +.copyToClipBoard:hover .copyToClipBoardBtn { + visibility: visible; +} + +.pre-scrollable { + max-height: 340px; + overflow-y: scroll; } + + +/* Nim line-numbered tables */ +.line-nums-table { + width: 100%; + table-layout: fixed; } + +table.line-nums-table { + border-radius: 4px; + border: 1px solid #cccccc; + background-color: ghostwhite; + border-collapse: separate; + margin-top: 15px; + margin-bottom: 25px; } + +.line-nums-table tbody { + border: none; } + +.line-nums-table td pre { + border: none; + background-color: transparent; } + +.line-nums-table td.blob-line-nums { + width: 28px; } + +.line-nums-table td.blob-line-nums pre { + color: #b0b0b0; + -webkit-filter: opacity(75%); + filter: opacity(75%); + text-align: right; + border-color: transparent; + background-color: transparent; + padding-left: 0px; + margin-left: 0px; + padding-right: 0px; + margin-right: 0px; } + + +table { + max-width: 100%; + background-color: transparent; + margin-top: 0.5em; + margin-bottom: 1.5em; + border-collapse: collapse; + border-color: var(--third-background); + border-spacing: 0; + font-size: 0.9em; +} + +table th, table td { + padding: 0px 0.5em 0px; + border-color: var(--third-background); +} + +table th { + background-color: var(--third-background); + border-color: var(--third-background); + font-weight: bold; } + +table th.docinfo-name { + background-color: transparent; + text-align: right; +} + +table tr:hover { + background-color: var(--third-background); } + + +/* rst2html default used to remove borders from tables and images */ +.borderless, table.borderless td, table.borderless th { + border: 0; } + +table.borderless td, table.borderless th { + /* Override padding for "table.docutils td" with "! important". + The right padding separates the table cells. */ + padding: 0 0.5em 0 0 !important; } + +.admonition { + padding: 0.3em; + background-color: var(--secondary-background); + border-left: 0.4em solid #7f7f84; + margin-bottom: 0.5em; + -webkit-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); + -moz-box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); + box-shadow: 0 5px 8px -6px rgba(0,0,0,.2); +} +.admonition-info { + border-color: var(--info-background); +} +.admonition-info-text { + color: var(--info-background); +} +.admonition-warning { + border-color: var(--warning-background); +} +.admonition-warning-text { + color: var(--warning-background); +} +.admonition-error { + border-color: var(--error-background); +} +.admonition-error-text { + color: var(--error-background); +} + +.first { + /* Override more specific margin styles with "! important". */ + margin-top: 0 !important; } + +.last, .with-subtitle { + margin-bottom: 0 !important; } + +.hidden { + display: none; } + +blockquote.epigraph { + margin: 2em 5em; } + +dl.docutils dd { + margin-bottom: 0.5em; } + +object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] { + overflow: hidden; } + + +div.figure { + margin-left: 2em; + margin-right: 2em; } + +div.footer, div.header { + clear: both; + text-align: center; + color: #666; + font-size: smaller; } + +div.footer { + padding-top: 5em; } + +div.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; } + +div.line-block div.line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; } + +div.topic { + margin: 2em; } + +div.search_results { + background-color: var(--third-background); + margin: 3vh 5vw; + padding: 1em; + border: 1px solid #4d4d4d; + position: fixed; + top: 10px; + isolation: isolate; + max-width: calc(100vw - 6em); + z-index: 1; + max-height: calc(100vh - 6em); + overflow-y: scroll;} + +div#global-links ul { + margin-left: 0; + list-style-type: none; } + +div#global-links > simple-boot { + margin-left: 3em; } + +hr.docutils { + width: 75%; } + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; } + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; } + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; } + +.align-left { + text-align: left; } + +.align-center { + clear: both; + text-align: center; } + +.align-right { + text-align: right; } + +/* reset inner alignment in figures */ +div.align-right { + text-align: inherit; } + +p.attribution { + text-align: right; + margin-left: 50%; } + +p.caption { + font-style: italic; } + +p.credits { + font-style: italic; + font-size: smaller; } + +p.label { + white-space: nowrap; } + +p.rubric { + font-weight: bold; + font-size: larger; + color: maroon; + text-align: center; } + +p.topic-title { + font-weight: bold; } + +pre.address { + margin-bottom: 0; + margin-top: 0; + font: inherit; } + +pre.literal-block, pre.doctest-block, pre.math, pre.code { + margin-left: 2em; + margin-right: 2em; } + +pre.code .ln { + color: grey; } + +/* line numbers */ +pre.code, code { + background-color: #eeeeee; } + +pre.code .comment, code .comment { + color: #5c6576; } + +pre.code .keyword, code .keyword { + color: #3B0D06; + font-weight: bold; } + +pre.code .literal.string, code .literal.string { + color: #0c5404; } + +pre.code .name.builtin, code .name.builtin { + color: #352b84; } + +pre.code .deleted, code .deleted { + background-color: #DEB0A1; } + +pre.code .inserted, code .inserted { + background-color: #A3D289; } + +span.classifier { + font-style: oblique; } + +span.classifier-delimiter { + font-weight: bold; } + +span.problematic { + color: #b30000; } + +span.section-subtitle { + /* font-size relative to parent (h1..h6 element) */ + font-size: 80%; } + +span.DecNumber { + color: var(--number); } + +span.BinNumber { + color: var(--number); } + +span.HexNumber { + color: var(--number); } + +span.OctNumber { + color: var(--number); } + +span.FloatNumber { + color: var(--number); } + +span.Identifier { + color: var(--identifier); } + +span.Keyword { + font-weight: 600; + color: var(--keyword); } + +span.StringLit { + color: var(--literal); } + +span.LongStringLit { + color: var(--literal); } + +span.CharLit { + color: var(--literal); } + +span.EscapeSequence { + color: var(--escapeSequence); } + +span.Operator { + color: var(--operator); } + +span.Punctuation { + color: var(--punctuation); } + +span.Comment, span.LongComment { + font-style: italic; + font-weight: 400; + color: var(--comment); } + +span.RegularExpression { + color: darkviolet; } + +span.TagStart { + color: darkviolet; } + +span.TagEnd { + color: darkviolet; } + +span.Key { + color: #252dbe; } + +span.Value { + color: #252dbe; } + +span.RawData { + color: var(--raw-data); } + +span.Assembler { + color: #252dbe; } + +span.Preprocessor { + color: #252dbe; } + +span.Directive { + color: #252dbe; } + +span.option { + font-weight: bold; + font-family: "Source Code Pro", Monaco, Menlo, Consolas, "Courier New", monospace; + color: var(--option); } + +span.Prompt { + font-weight: bold; + color: red; } + +span.ProgramOutput { + font-weight: bold; + color: #808080; } + +span.program { + font-weight: bold; + color: var(--program); + text-decoration: underline; + text-decoration-color: var(--hint); + text-decoration-thickness: 0.05em; + text-underline-offset: 0.15em; } + +span.Command, span.Rule, span.Hyperlink, +span.Label, span.Reference, span.Other { + color: var(--other); } + +/* Pop type, const, proc, and iterator defs in nim def blocks */ +dt pre > span.Identifier, dt pre > span.Operator { + color: var(--identifier); + font-weight: 700; } + +dt pre > span.Keyword ~ span.Identifier, dt pre > span.Identifier ~ span.Identifier, +dt pre > span.Operator ~ span.Identifier, dt pre > span.Other ~ span.Identifier { + color: var(--identifier); + font-weight: inherit; } + +/* Nim sprite for the footer (taken from main page favicon) */ +.nim-sprite { + display: inline-block; + width: 51px; + height: 14px; + background-position: 0 0; + background-size: 51px 14px; + -webkit-filter: opacity(50%); + filter: opacity(50%); + background-repeat: no-repeat; + background-image: var(--nim-sprite-base64); + margin-bottom: 5px; } + +span.pragmadots { + /* Position: relative frees us up to make the dots + look really nice without fucking up the layout and + causing bulging in the parent container */ + position: relative; + /* 1px down looks slightly nicer */ + top: 1px; + padding: 2px; + background-color: var(--third-background); + border-radius: 4px; + margin: 0 2px; + cursor: pointer; + font-size: 0.8em; } + +span.pragmadots:hover { + background-color: var(--hint); } + +span.pragmawrap { + display: none; } + +span.attachedType { + display: none; + visibility: hidden; } diff --git a/taste.svg b/taste.svg new file mode 100644 index 00000000..9110b6f0 --- /dev/null +++ b/taste.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + 🟢 the trampoline runs continuations, uh, continuously🟢 the noop magic smoke test demonstrates shedding scope## 2 tests 🟢2 var r = 0🟢 local variables migrate into the continuation🟢 out-of-scope variables operate as expected🟢 tuple deconstruction with a call source works🟢 tuple deconstruction with distinct types works🟢 declaration via tuple deconstruction works🟢 multi-variable declaration with shared initialization🟢 shadowing and proc param defaults are supportedreassignment of mutable var proc params: pending issue #47🟢 a block statement with a break under an if🟢 a block with a continuation followed by a break🟢 a while statement with a continuation and a break🟢 a break inside a multiply-nested else inside a while🟢 named breaks are supported, with nested breaks🟢 named breaks work from inside a while statement🟢 while loops correctly, uh, loop🟢 proc parameters pass across continuations🟢 local variables may shadow proc parameters🟢 shadowing variables may impart new mutability🟢 shadowing variables pass across continuations🟢 scope-based shadowing is also supported🟢 shadowing is unperturbed by continuation calls🟢 case statements can support control-flow🟢 a continue statement within a while statement works🟢 a gratuitously complex shadowing test workslocal assignment to a continuation return value: pending discussion #28🟢 a while statement supports a local variable inside🟢 calling a function pointer inside an object works🟢 calling a macro that calls a foreign symbol works🟢 calling a template with explicit symbol binding🟢 template calls inside nested call nodes are fine🟢 calling a function pointer produced by an expression🟢 a simple if-else split across continuations works🟢 a simple case statement split across continuations works🟢 try-except statements may be split across continuations🟢 try-except statements may split and also raise exceptions🟢 exception clauses may split across continuations🟢 exceptions raised in the current continuation worktry statements with a finally clause: not working, see #78try statements with an exception and a finally: not working, see #78🟢 block control-flow across continuations works🟢 if control-flow across continuations worksa defer statement works across a continuation: not working, see #80implicit generics in continuation creation: not working, ref #51explicit generics in continuation creation: not working, ref #51🟢 nested blocks with an interior break works🟢 a basic defer statement is supported🟢 a defer in a nested template is supported🟢 a defer inside a block statement works🟢 a naked defer is not a problem🟢 various varargs usages are supported just fine🟢 for loops with a continue and a break work correctlyfor loops with a continue and break across continuations: pending #48🟢 a while loop with only a single continuing call works🟢 cooperative yield hooks are used automatically🟢 control-flow tracing hooks are used automatically🟢 custom continuation allocators are used automatically🟢 custom continuation deallocators are used automatically## 59 tests 🟢51 ❔8 + \ No newline at end of file diff --git a/techo.svg b/techo.svg new file mode 100644 index 00000000..1ba68a26 --- /dev/null +++ b/techo.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + zevv's echo service: off for now## 1 tests ❔1 + \ No newline at end of file diff --git a/theindex.html b/theindex.html new file mode 100644 index 00000000..7803b823 --- /dev/null +++ b/theindex.html @@ -0,0 +1,1738 @@ + + + + + + + +Index + + + + + + + + + + + + +
+
+

Index

+ Modules: cps, cps/defers, cps/environment, cps/exprs, cps/help, cps/hooks, cps/normalizedast, cps/returns, cps/rewrites, cps/spec, cps/transform.

API symbols

+
`$`:
+
`()`:
+
`==`:
+
`[]=`:
+
`[]`:
+
AccessNodes:
+
add:
+
addInitializationToDefault:
+
addPragma:
+
alloc:
+
Alloc:
+
asCall:
+
asCallKind:
+
asConv:
+
asIdentDefs:
+
asName:
+
asNameAllowEmpty:
+
asPragmaAtom:
+
asPragmaBlock:
+
asPragmaStmt:
+
asProcDef:
+
asRoutineDef:
+
assignTo:
+
asSym:
+
asTypeDef:
+
asTypeExpr:
+
asTypeExprAllowEmpty:
+
asTypeExprObj:
+
asTypeExprRef:
+
asTypeSection:
+
asVarLet:
+
asVarLetIdentDef:
+
asVarLetTuple:
+
bindName:
+
body:
+
body=:
+
boot:
+
Boot:
+
bootstrapSymbol:
+
breakLabel:
+
CachePair:
+
Call:
+
call:
+
Callback:
+
callingParams:
+
CallKind:
+
cCallToNormNode:
+
cConvToNormNode:
+
cDefVarLetToNormNode:
+
cFormalParamsToNormNode:
+
childCallToRecoverResult:
+
cIdentDefLetToIdentDef:
+
cIdentDefLetToNormNode:
+
cIdentDefToNimNode:
+
cIdentDefToNormNode:
+
cIdentDefVarToIdentDef:
+
cIdentToNimNode:
+
cLetIdentDefToVarLetIdentDef:
+
cLetSectionToNormNode:
+
clone:
+
cNameToNormNode:
+
cNormNodeToNimNode:
+
colon:
+
comments:
+
ConstructNodes:
+
Continuation:
+
ContinuationObj:
+
ContinuationProc:
+
Conv:
+
ConvNodes:
+
coop:
+
Coop:
+
copy:
+
copyLineInfo:
+
copyNimNode:
+
copyNimTree:
+
copyNodeAndTransformIt:
+
copyOrVoid:
+
cPragmaAtomToNormNode:
+
cPragmaStmtToNormNode:
+
cProcDefToNormNode:
+
cProcDefToRoutineDef:
+
cps:
+
cpsBootstrap:
+
cpsBreak:
+
cpsCall:
+
cpsCallback:
+
cpsCallbackShim:
+
cpsCallbackTypeDef:
+
cpsCallOperatorSupported:
+
cpsCont:
+
cpsContinue:
+
cpsDebug:
+
cpsEnvironment:
+
cpsFlattenExpr:
+
cpsHasException:
+
cpsLift:
+
cpsMagic:
+
cpsMagicCall:
+
cpsMustJump:
+
cpsPending:
+
cpsResult:
+
cpsReturnType:
+
cpsStackFrames:
+
cpsTerminate:
+
cpsTraceDeque:
+
cpsTransform:
+
cpsVoodoo:
+
cpsVoodooCall:
+
createBootstrap:
+
createCallback:
+
createCallbackShim:
+
createContinuation:
+
createRecover:
+
createWhelp:
+
cRoutineDefToNimNode:
+
cRoutineDefToNormNode:
+
cRoutineParamToIdentDef:
+
cRoutineParamToNormNode:
+
cSymToName:
+
cSymToNormNode:
+
cTypeExprRefToTypeExpr:
+
cTypeExprToNormNode:
+
cVarIdentDefToVarLetIdentDef:
+
cVarLetIdentDefToNormNode:
+
cVarLetToNormNode:
+
cVarLetTupleToNormNode:
+
cVarSectionToNimNode:
+
cVarSectionToNormNode:
+
dealloc:
+
Dealloc:
+
debug:
+
debugAnnotation:
+
def:
+
DefLike:
+
desym:
+
disarm:
+
dismiss:
+
dismissed:
+
doc:
+
dot:
+
DotExpr:
+
emptyAsNil:
+
enbasen:
+
ensimilate:
+
Env:
+
eq:
+
eqIdent:
+
errorAst:
+
errorGot:
+
etype:
+
expr:
+
ExprLike:
+
filter:
+
filterPragma:
+
findChild:
+
findChildRecursive:
+
findColonLit:
+
finished:
+
first:
+
firstCallParam:
+
firstDef:
+
firstReturn:
+
FormalParams:
+
formalParams:
+
formalParams=:
+
genException:
+
genField:
+
genProcName:
+
genSymField:
+
genSymLet:
+
genSymProc:
+
genSymType:
+
genSymUnknown:
+
genSymVar:
+
genTypeName:
+
getContSym:
+
getImpl:
+
getPragmaName:
+
getResult:
+
getTypeInst:
+
hash:
+
hasImpl:
+
hasPragma:
+
hasType:
+
hasValue:
+
head:
+
Head:
+
HiddenNodes:
+
hook:
+
Hook:
+
Ident:
+
IdentDef:
+
identdef:
+
IdentDefLet:
+
IdentDefLike:
+
IdentDefVar:
+
IdentDefVarLet:
+
identity:
+
ifCallKindThenIt:
+
ifCallThenIt:
+
impl:
+
indexNamePairs:
+
inferTypFromImpl:
+
inherits:
+
initFrame:
+
introduce:
+
isCpsBlock:
+
isCpsBreak:
+
isCpsCall:
+
isCpsCont:
+
isCpsContinue:
+
isCpsConvCall:
+
isCpsPending:
+
isCpsTerminate:
+
isDirty:
+
isEmpty:
+
isExported:
+
isNil:
+
isNotNil:
+
isScopeExit:
+
isSymbol:
+
isTuple:
+
isVoodooCall:
+
items:
+
jumperCall:
+
kind:
+
last:
+
len:
+
LetIdentDef:
+
LetSection:
+
LetSectionLike:
+
lineAndFile:
+
localSection:
+
makeErrorShim:
+
makeLineInfo:
+
makeReturn:
+
makeType:
+
matchCpsBreak:
+
Matcher:
+
maybeConvertToRoot:
+
multiReplace:
+
Name:
+
name:
+
name=:
+
nameForNode:
+
newAssignment:
+
newCall:
+
newColonExpr:
+
newCpsBreak:
+
newCpsContinue:
+
newCpsPending:
+
newCpsTerminate:
+
newDotExpr:
+
newEmptyNormNode:
+
newEnv:
+
newFormalParams:
+
newIdentDef:
+
newIdentDefVar:
+
newLetIdentDef:
+
newNodeAndTransformIt:
+
newPragmaColonExpr:
+
newPragmaStmt:
+
newPragmaStmtWithInfo:
+
newProcDef:
+
newRefType:
+
newStmtList:
+
newTree:
+
newVarIdentDef:
+
newVarLetIdentDef:
+
newVarSection:
+
nilAsEmpty:
+
NilNimNode:
+
NilNormNode:
+
NodeFilter:
+
NormalCallNodes:
+
normalizeCall:
+
normalizeProcDef:
+
NormalizingFilter:
+
normalizingRewrites:
+
NormFilter:
+
NormMatcher:
+
NormNode:
+
onlyNormalizedNode:
+
pairs:
+
pass:
+
Pass:
+
performUntypedPass:
+
postfix:
+
Pragma:
+
pragma:
+
pragma=:
+
pragmaArgument:
+
PragmaAtom:
+
PragmaBlock:
+
PragmaExpr:
+
PragmaHaver:
+
PragmaLike:
+
PragmaStmt:
+
prependArg:
+
ProcDef:
+
procedure:
+
recover:
+
RecursiveNode:
+
renderStackFrames:
+
renderTraceDeque:
+
replace:
+
replacedSymsWithIdents:
+
resym:
+
returnParam:
+
returnParam=:
+
rewriteCalls:
+
rewriteDefer:
+
rewriteIt:
+
rewriteResult:
+
rewriteReturn:
+
rewriteSymbolsIntoEnvDotField:
+
rewriteVoodoo:
+
root:
+
RoutineDef:
+
RoutineDefLike:
+
RoutineParam:
+
running:
+
sameType:
+
seqNormalizedToSeqNimNode:
+
sinkAnnotated:
+
smartSniffer:
+
stack:
+
Stack:
+
state:
+
State:
+
storeType:
+
stripPragma:
+
strVal:
+
sym:
+
Sym:
+
tail:
+
Tail:
+
tailCall:
+
terminator:
+
trace:
+
Trace:
+
traceDeque:
+
traceDequeSize:
+
TraceFrame:
+
trampoline:
+
trampolineIt:
+
TupleDefVarLet:
+
typ:
+
TypeDef:
+
TypeExpr:
+
TypeExprLike:
+
TypeExprObj:
+
TypeExprRef:
+
typeInst:
+
typeKind:
+
TypeSection:
+
Unwind:
+
unwind:
+
updateLineInfoForContinuationStackFrame:
+
upgradeToNormalizedNode:
+
val:
+
VarIdentDef:
+
VarLet:
+
VarLetIdentDef:
+
VarLetIdentDefLike:
+
VarLetLike:
+
VarLetTuple:
+
VarSection:
+
VarSectionLike:
+
whelp:
+
whelpIt:
+
workaroundRewrites:
+
wrap:
+
wrappedFinally:
+
writeStackFrames:
+
writeTraceDeque:
+
+ +
+
+ + + + + + diff --git a/tzevv.svg b/tzevv.svg new file mode 100644 index 00000000..5d0cbd9d --- /dev/null +++ b/tzevv.svg @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + 🟢 nocall🟢 onecall🟢 twocall🟢 if true🟢 if false🟢 if true if false🟢 nested if 1🟢 nested if 2🟢 nested if 3🟢 block1🟢 while1🟢 break1🟢 break2🟢 for1🟢 for2🟢 multiple variables in one varone 0🟢 wrongreturn🟢 continue🟢 for3defer: pending try-finally rewrite🟢 nested while🟢 paper example 1 proc foo(c: C; fd: int16): C {.cpsMagic.} = discard 🟢 int🟢 'i16🟢 int16()🟢 .int16🟢 type problem01🟢 Running -> Lampable -> Done## 28 tests 🟢27 ❔1 + \ No newline at end of file