Skip to content

Commit 6f01da6

Browse files
committed
more docs
1 parent 827c1da commit 6f01da6

File tree

5 files changed

+93
-11
lines changed

5 files changed

+93
-11
lines changed

docs/Manual.html

+39-5
Original file line numberDiff line numberDiff line change
@@ -4086,15 +4086,15 @@ <h2 id="_high_level_compiler_workflow"><a class="anchor" href="#_high_level_comp
40864086
Typedtree
40874087
|
40884088
| (Reuse OCaml pattern match compiler and erase types)
4089-
|
4089+
| (Patches to pass more information down to Lambda )
40904090
|
40914091
OCaml Lambda IR
40924092
|
40934093
|
40944094
v
40954095
Buckle Lambda IR ------------------+
40964096
| ^ |
4097-
| | Lambda Passes (lam_* files)
4097+
| | 6 Lambda Passes (lam_* files)
40984098
| | Optimization/inlining/dead code elimination
40994099
| \ |
41004100
| \ --------------------------+
@@ -4104,7 +4104,7 @@ <h2 id="_high_level_compiler_workflow"><a class="anchor" href="#_high_level_comp
41044104
V
41054105
JS IR (J.ml) ---------------------+
41064106
| ^ |
4107-
| | JS Passes (js_* files)
4107+
| | 6 JS Passes (js_* files)
41084108
| | Optimization/inlining/dead code elimination
41094109
| \ |
41104110
| \ -------------------------+
@@ -4368,11 +4368,45 @@ <h3 id="_simple_ocaml_type"><a class="anchor" href="#_simple_ocaml_type"></a>Sim
43684368
</tr>
43694369
<tr>
43704370
<td class="tableblock halign-left valign-top"><p class="tableblock">Variant</p></td>
4371-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>internal</strong></p></td>
4371+
<td class="tableblock halign-left valign-top"><div><div class="paragraph">
4372+
<p><strong>internal</strong> (subject to change)</p>
4373+
</div>
4374+
<div class="paragraph">
4375+
<p>Simple Variants: (Variants with only one non-nullary constructor)</p>
4376+
</div>
4377+
<div class="listingblock">
4378+
<div class="content">
4379+
<pre class="pygments highlight"><code data-lang="ocaml"><span class="tok-k">type</span> <span class="tok-n">tree</span> <span class="tok-o">=</span>
4380+
<span class="tok-o">|</span> <span class="tok-nc">Leaf</span>
4381+
<span class="tok-o">|</span> <span class="tok-nc">Node</span> <span class="tok-k">of</span> <span class="tok-kt">int</span> <span class="tok-o">*</span> <span class="tok-n">tree</span> <span class="tok-o">*</span> <span class="tok-n">tree</span>
4382+
<span class="tok-c">(* Leaf --&gt; 0 *)</span>
4383+
<span class="tok-c">(* Node(a,b,c) --&gt; [a,b,c]*)</span></code></pre>
4384+
</div>
4385+
</div>
4386+
<div class="paragraph">
4387+
<p>Complex Variants: (Variants with more than one non-nullary constructor)</p>
4388+
</div>
4389+
<div class="listingblock">
4390+
<div class="content">
4391+
<pre class="pygments highlight"><code data-lang="ocaml"><span class="tok-k">type</span> <span class="tok-n">u</span> <span class="tok-o">=</span>
4392+
<span class="tok-o">|</span> <span class="tok-nc">A</span> <span class="tok-k">of</span> <span class="tok-kt">string</span>
4393+
<span class="tok-o">|</span> <span class="tok-nc">B</span> <span class="tok-k">of</span> <span class="tok-kt">int</span>
4394+
<span class="tok-c">(* A a --&gt; [a].tag=0 -- tag 0 assignment is optional *)</span>
4395+
<span class="tok-c">(* B b --&gt; [b].tag=1 *)</span></code></pre>
4396+
</div>
4397+
</div></div></td>
43724398
</tr>
43734399
<tr>
43744400
<td class="tableblock halign-left valign-top"><p class="tableblock">Polymorphic variant</p></td>
4375-
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>internal</strong></p></td>
4401+
<td class="tableblock halign-left valign-top"><div><div class="paragraph">
4402+
<p><strong>internal</strong></p>
4403+
</div>
4404+
<div class="listingblock">
4405+
<div class="content">
4406+
<pre class="pygments highlight"><code data-lang="ocaml"><span class="tok-o">`</span><span class="tok-n">a</span> <span class="tok-c">(* 97 *)</span>
4407+
<span class="tok-o">`</span><span class="tok-n">a</span> <span class="tok-mi">1</span> <span class="tok-mi">2</span> <span class="tok-c">(* [97, [1,2] ]*)</span></code></pre>
4408+
</div>
4409+
</div></div></td>
43764410
</tr>
43774411
<tr>
43784412
<td class="tableblock halign-left valign-top"><p class="tableblock">exception</p></td>

jscomp/bench/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ocamlc.opt -g bal_set_mini.ml -o bal_set_mini.byte && js_of_ocaml bal_set_mini.b
44
ocamlopt.opt -g bal_set_mini.ml -o bal_set_mini.native
55
bscc -c bal_set_mini.ml
66
java -jar /usr/local/lib/node_modules/google-closure-compiler/compiler.jar --compilation_level ADVANCED --js bal_set_mini.js --js_output_file bal_set_mini.goog.js
7-
# time node bal_set_mini.js
7+
time node immutable_set_min.js
88
time node bal_set_mini.goog.js
99
time node bal_set_mini.jsoo.js
1010
time bal_set_mini.byte

jscomp/bench/immutable_set_min.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
var Immutable = require('immutable')
2+
3+
var set = Immutable.Set()
4+
5+
for(var i = 0; i <= 2000000; ++i){
6+
set = set.add(i);
7+
}
8+
for(var i = 0; i <= 2000000; ++i){
9+
if (!set.has(i)){
10+
console.log("impossible")
11+
}
12+
}
13+
for(var i = 0; i <= 2000000;++i){
14+
set = set.delete(i)
15+
}
16+
17+
if(set.size!==0){
18+
console.log('impossible')
19+
}

site/docsource/Compiler-overview.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ Surface Syntax Tree
2020
Typedtree
2121
|
2222
| (Reuse OCaml pattern match compiler and erase types)
23-
|
23+
| (Patches to pass more information down to Lambda )
2424
|
2525
OCaml Lambda IR
2626
|
2727
|
2828
v
2929
Buckle Lambda IR ------------------+
3030
| ^ |
31-
| | Lambda Passes (lam_* files)
31+
| | 6 Lambda Passes (lam_* files)
3232
| | Optimization/inlining/dead code elimination
3333
| \ |
3434
| \ --------------------------+
@@ -38,7 +38,7 @@ Buckle Lambda IR ------------------+
3838
V
3939
JS IR (J.ml) ---------------------+
4040
| ^ |
41-
| | JS Passes (js_* files)
41+
| | 6 JS Passes (js_* files)
4242
| | Optimization/inlining/dead code elimination
4343
| \ |
4444
| \ -------------------------+

site/docsource/Runtime-representation.adoc

+31-2
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,39 @@ For example:
7373
* `[]` -> `0`
7474
* `x::y` -> `[x,y]`
7575
* `1::2::[3]` -> `[ 1, [ 2, [ 3, 0 ] ] ]`
76-
| Variant | *internal*
76+
| Variant a| *internal* (subject to change)
7777
78-
| Polymorphic variant | *internal*
78+
Simple Variants: (Variants with only one non-nullary constructor)
7979
80+
[source,ocaml]
81+
--------------
82+
type tree =
83+
\| Leaf
84+
\| Node of int * tree * tree
85+
(* Leaf --> 0 *)
86+
(* Node(a,b,c) --> [a,b,c]*)
87+
--------------
88+
89+
Complex Variants: (Variants with more than one non-nullary constructor)
90+
91+
[source,ocaml]
92+
-------------
93+
type u =
94+
\| A of string
95+
\| B of int
96+
(* A a --> [a].tag=0 -- tag 0 assignment is optional *)
97+
(* B b --> [b].tag=1 *)
98+
-------------
99+
100+
101+
102+
| Polymorphic variant a| *internal*
103+
104+
[source,ocaml]
105+
-------------
106+
`a (* 97 *)
107+
`a 1 2 (* [97, [1,2] ]*)
108+
-------------
80109
| exception | *internal*
81110
| extension | *internal*
82111

0 commit comments

Comments
 (0)