1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
2 <html xmlns=
"http://www.w3.org/1999/xhtml" lang=
"en" xml:lang=
"en">
3 <head><meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
4 <style type=
"text/css">@
import 'doc.css';</style>
6 <pre style=
"background:#AE6;width:25em;float:right;padding-right:2em">
24 <p>See the <a href="start.html">pamphlet</a>
for an overview of the potion syntax and data structures.</p>
26 <dt><a
name=
"tuple">tuple</a></dt>
27 <dd>an ordered list</dd>
30 <dt><a
name=
"table">table</a></dt>
32 but with list syntax</dd>
35 <dt><a
name=
"lick">lick</a></dt>
36 <dd>a nested data structure, i.e. named hash. the keys are called <code>path</code>.</dd>
38 <p>Every lick can have a
name, a table of attributes, and a list of<br />
39 children. The list of children can, instead, be a
Potion data<br />
40 type, such as a number or
string or something.</p>
42 <dt><a name=
"path">path</a></dt>
43 <dd>key of a <code>lick</code>, an instance variable of an
object.</dd>
45 <p>Paths cannot be randomly added to the
object after the object<br />
46 is created. Each
object has a strict set of paths. Every path<br />
47 which is used in the constructor is added to the
object upon<br />
50 <dt><a name=
"upvalue">upvalue</a></dt>
51 <dd>A variable in an upper scope.</dd>
53 <p>Since a closure doesn’t have access to the registers<br />
54 of another
function, these variables are passed<br />
57 <dt><a name=
"lobby">
Lobby</a></dt>
58 <dd>potion named the
main interp object <code>
Lobby</code>, which holds the<br />
59 methods <code>about</code>, <code>here</code>, <code>exit</code>, <code>
self</code>, …<br />
60 p2 renames it to <code>
"P2"</code></dd>
63 <dt><a name=
"mop">mop</a></dt>
64 <dd>potion/p2 uses the <a href=
"http://piumarta.com/software/cola/objmodel2.pdf">cola mop</a><br />
65 with 5 core functions: <code>addMethod</code>, <code>lookup</code>, <code>allocate</code>, <code>delegated</code> and <code>intern</code>.<br />
66 And 4 native (and jitted) VM ops: <code>SELF</code>, <code>CLASS</code>, <code>BIND</code> and <code>MSG</code>.<br />
67 <img src=
"p2-mop.png" title=
"p2-mop" alt=
"p2-mop" /></dd>
70 <dt><a name=
"flex">flex</a></dt>
71 <dd>the mixin type. A mixin is created with <code>
potion_type_new()</code> referencing a parent type, and are handled with <code>
PN_FLEX</code> macros.</dd>
int main(int argc, char *argv[])
root namespace, the global environment and parent class of all builtins.
a weak ref is used for upvals, it acts as a memory slot, non-volatile but mutable.
PN potion_type_new(Potion *P, PNType t, PN self)
create a non-user type, derived from self
the global interpreter state P. currently singleton (not threads yet)