diff --git a/index.html b/index.html new file mode 100644 index 0000000000..92f766d013 --- /dev/null +++ b/index.html @@ -0,0 +1,150 @@ + + + + + OCaml toplevel + + + + + + +
+

+      
+
+ + + + + + + +
+
+
+

Js_of_ocaml

+

A compiler from OCaml bytecode to Javascript.

+

It allow to write OCaml programs that run on Web browsers. It is + easy to install as it works with an existing installation of OCaml, + with no need to recompile any library. It comes with bindings for a + large part of the browser APIs.

+

This web-based OCaml toplevel is compiled using Js_of_ocaml.

+

Command

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enter/ReturnSubmit code
Ctrl + EnterNewline
Up / DownBrowse history
Ctrl + lClear display
Ctrl + kReset toplevel
TabIndent code
+

Try to execute samples

+
+

See the generated javascript code

+
+      
+
+ + diff --git a/toplevel.js b/toplevel.js new file mode 100644 index 0000000000..3d5cf0c9a6 --- /dev/null +++ b/toplevel.js @@ -0,0 +1,31471 @@ +// This program was compiled from OCaml by js_of_ocaml 1.99dev +(function(joo_global_object){"use strict";var +cU=254,a2=16777215,Iq="ocamlmklib",HD="CamlinternalOO",re=0.5,k6="lor",ah4=293,aai=278,afz="add",aag="Rinherit\n",aah="Ptyp_any\n",xy="caml_js_get",acP="%a = mk_bool(%a >= %a)@.",aaf=":\n ",ru="!",fH=115,fA="[]",afy="\n",Jc="Topdirs",Jd="float_of_string",acO="\\x",jB="merge_info",jA="block",aae="Nativeint",ah3="Ptype_abstract\n",acN=1026,rt="record",afx=" %a\n",Ip="ocamlopt",ah2="Queue",afw=-216458258,ah1="MacOS",aad="%.18g",hf=1023,acM="Pmod_apply\n",cJ=-448369099,wX="value_description",aab=282,aac="The debug named %S doesn't exist@.",afv="Pexp_ifthenelse\n",acL=174,wW="typing/printtyped.ml",iq=">",acK="Pmty_ident %a\n",afu="Ppat_tuple\n",ah0="Pexp_constraint\n",Jb="CamlinternalMod",aaa='Ptyp_alias "%s"\n',rs="float",acJ="caml_le_float",jJ="src/core/lwt.ml",ahZ="List",Ja=141,acI=272,ahY=-481604174,aft="Ptyp_object\n",afs="Sys",I$=".cmi",xT=-49,fb="method",I_="throw",ahX="",$$="nth",afr="Pexp_array\n",$_="under_ifthenelse",acH="table",afq="Cannot find file %s.@.",rW="e",afp=276,wV="@[<2>%a@]",afo="caml_lt_float",$9="caml_int64_of_nativeint",jI="Array",xf="int32",xx="class_field",nT=" ",nw="do",acG="package",Io="Bigarray",acF="caml_greaterequal",nS=140,ahW="caml_ge_float",ec="type",$8="The option named %S doesn't exist@.",lf=1024,fd=782176664,HC="caml_js_const",hn="module",rr="try",afn="auto",acE="clear",ahV="type_declaration %a\n",acD=1258,ahU="infinity",acC="caml_string_notequal",In="private",acB=8254,$7="arg",acA="sub",aJ=-1021444811,ahS="then",ahT="Filename",acz="caml_equal",afm="Ptyp_poly%a\n",$6="\\t",afl="commuting this argument",acy="immutable",acx="%a is no longer traced.@.",ahR="paren",$5="@ =@ %a",q=103,Im=-16,afk="@,@[The type constructor@;<1 2>%a@ would escape its scope@]",acw="%caml_js_opt_call",afj="class_declaration",$4=5493713,$3=295,dh="statement",wU=223,afi=500,wT=308,acv="While parsing '",acu="ptype_manifest =\n",afh=1374,act="caml_trampoline_return",GJ="SYMB",$2="type_param",afg="@,|",ahQ="open",eb=256,bn=5795659,$1="to_int",GI=65520,aff="Psig_type\n",cI="expression",ahP="../",HB=395,cg="%s",ahO="state_",ahN="Psig_class\n",xS="Assert_failure",ahM=338,$0="Pwith_type\n",k5="times",acs="size",xR=-108,HA="@[%a@]",k$=129,I9="@\n",ahL=350,wS="exception_declaration",rd=326,go="get",bO=",",$Z="Stack",afe=-191124516,I8=">=",GH="Toploop",I7="caml_alloc_dummy",xw="return",ahK="caml_nativeint_to_int32",$Y="copy",GG="list",afd="word_size",ahJ="%s[%d]",ahI="Const_int %d",rV=";@;",e$=120,fF="expression_o",$X='Pexp_open %a "%a"\n',Il="@[%a%a@]",rc="is not compatible with type",Ik="|]",xe=888960333,rL="%int_or",fG=117,$V="caml_wrap_exception",$W=" %s %a@.",acr="ptype_private = %a\n",Ij="caml_int_compare",$U="@[<2>%a@ =@ %a@]",acq="Callback",afc=" None",ahF=150,ahG="Pexp_poly\n",ahH="utils/tbl.ml",acp="virtual",ahE=560,ahD="set_var",ahC=294,xQ=343,iw="lsr",ahB="get_meth",Ii="%sendcache",acn=279,aco="Map",$T="caml_div_float",GF=112,xd="x",I6="begin",nR="String",acm=947848242,afb="implementation",GE="caml_int64_of_int32",$S=32767,Ih=336,Hz="xor",fB="%d",afa=274,wR=200,nv="[",rq="Cygwin",$R=286,Hy="meth",Hx="Uncaught exception: %s\n",acl="selfpat-",$Q="%caml_js_opt_object",ack="Pexp_sequence\n",Ig="%a@;",aG=-48,ahA="Down",acj="env_init",ip="set",aci="@[<2>`%s@ %a@]",ahz="class type",$P="Digest.from_hex",xc="int64",rK="but is expected to have type",ahy="Pctf_inher\n",If='pci_name = "%s"\n',ae$="Pcl_constraint\n",$O="caml_eq_float",ae_="core_field_type %a\n",ahx=263,hh="*",xP=-333051743,le="else",ach=259,I5="Int32",$N=260,ahw=342,Hw=" %s@.",$M="%sequand",Hv=1001,acg="Pmty_typeof\n",rp="match",xv="field",acf="Psig_recmodule\n",aQ=246,ae9="Pcl_structure\n",Hu="%s:%a",ae8="@[<2>%s@;%a@]",kZ="instance variable",Ie="%LdL",$L="Stream",ae7="unsafe_",ea="sources",ace=325,gA=122,GD="Stack_overflow",$K="Pwith_module %a\n",ahv="@[%a.{%a}@ <-@ %a@]",ae6="Parmatch.get_tag",GC="ex",Ht="Not_found",$J="done",GB=287,$I=298,$H=291,acd="./",ahu="Weak",ae5="@[class @[<2>",xb=443687981,ae4="big_endian",aht=309,eB="parse_bytecode.ml",jF=106,I4=" position ",ae3="Pexp_new %a\n",$G="direction_flag",$F="class_type_declaration",nu="pci_virt = %a\n",acc="class_type_declaration %a\n",xu="typing/includemod.ml",$E="Pstr_eval\n",hm=124,ahs="Sort",e_="?",eA="false",jz="src/approx_lexer.mll",ae2="push",acb=".cmo",wQ=133,$D="': ",he="mod",nQ="%int_div",aca="\\u",$C="shortvar",ahr=8195,$B="ostype_unix",rb="option",ae1="Pexp_construct %a\n",ahq="binding",ae0="type_with_label",Id=32752,dk="_",ab$="]\n",GA="ocamlbrowser",$A="%a = !%a@.",ab_="core_type",Gz="Invalid_argument",rJ=639620572,ahp=380,gt=748778728,wO="class_type",wP="module_expr",Hr=264,Hs='"%s"(%a)',Hq="%LiL",ahn="simple_pattern",aho="BOOL",$z=199524600,rI=119,nB="&",ro="debugger",ab9="raise",xt="mutable",ahm=262,$y="Override",I3="label",Hp=265,ab8=332,jy="]",Ho=135,ab7=426,fE="0",xa=136,aeZ="caml_notequal",$x="iter_up: recursive application not allowed",aeY="p",ahl="exc",Gy=121,fz="program",xO=107,Ic=131,I2="%caml_format_int_special",wN="nativeint",$w=349,k4="`%s",w$=261,ab=105,hg="object",Gx="break",xs=-944563106,$v=-453122489,rn=251,ahk="Hashtbl",ab6="@[<2>[|%a|]@]",Gw="Array2",I1=253,$u="ptype_params =\n",$t=362,wM=139,xN=321,ab5='Pexp_newtype "%s"\n',ahj="caml_array_get_addr",ab4="Pwith_typesubst\n",Ib="ocamldep",$s="Ppat_array\n",ab3="Change one of them.",aeX="expression1",rU="self-",hl="::",ahi="Ptyp_variant closed=%s\n",ab2="%caml_js_opt_new",aeW=351,I0="typeof",Hn=411,ahh="Unbound module type %a",$r="Const_nativeint %nd",ab1="Virtual",aeV="Pstr_type\n",IZ="Type",ahg="Pexp_match\n",k3="in",bW=250,aeT=222,aeU="E",aeS="bad tag name specification",Ia=-12,xr="none",ab0=302,aeR="%s%a",abZ="Pexp_while\n",Gv="caml_array_set",$q="ptype_cstrs =\n",ahf=456,aeQ="caml_mul_float",aeP="pattern %a\n",gn=-201766268,nt="%int_mod",gs="{",H$="instanceof",rH=-80621036,b3=100,H_="%ndn",$p="*@;",aeO=487,IY=-17,nP=" (undocumented)",$o="@[%a.{%a}@]",aeN="Pexp_constant %a\n",H9=438,$n="caml_nativeint_compare",w_="%C",io=1e3,abY=277,ahe="%a[%a] = %a@.",ra=138,Gu=812216871,wL=892857089,$m="caml_int64_to_nativeint",abX="mutable ",ahd="@]@;@[<2>and ",IX='"%s"\n',iy=127,ahc=346,abW="MoreLabels",aeM=" )",$l=273,Gt="void",abV="close",am=")",IW="PRIM",xq="let",$k="bswap",aeL="Pexp_when\n",aeK="%.15g",H8="nan",ahb="0123456789abcdef",rG="caml_js_set",aha="Nonrec",js="/",ag$="@[<0>%a@]",q$="%int_and",Hm="CRCS",aeJ="\\r",j="number",$j="",aeI="Pstr_value %a\n",$i="#recmod#",ag_=313,wK=" not found.",ez="function",nA="#row",abU="Ppat_construct %a\n",Hl=396,ag9="a float",abT=493,ag8=402,Hk="|",H7="End_of_file",ag7="Set",abS=311,Hj="caml_js_var",wJ="..",ns="new",H6="Failure",$h=",\n",b6="typing/typecore.ml",k_="with",abR="Pmodtype_abstract\n",Hi="bytecomp/bytegen.ml",aeH="fun %a (",ag6=-20,Hh=315,aeG="inherit",aeF="The file %a is not a bytecode object file",q_=323,IV=-91,wI="Pervasives",Hg=303,aeE="[\n",$g="@[<2>%a -->@ %a@]@.",abQ="Lazy",ag5="class_description",IU="Sys_error",aeD="sharp",IT="fun",$f="caml_register_global",aeC='Rtag "%s" %s\n',wH="module type",abP="of_int",aeB="signature_item %a\n",ag4="type_var_option",$e="Pcl_let %a\n",gm="int_of_string",nJ="None",IS=132,abO=458,xM=160,ag3="Const_int64 %Ld",IR=347,w8="type_declaration",w9=284,w7="include",$d="functor",$c=271,aeA=335,gu="or",Hf=498,aez="caml_get_public_method",ag2="@[<2>class %a@]",IQ="assert",jx=-792364981,ag1="caml_array_unsafe_get_float",q8=961089336,q9="%int_neg",He="@]",IP=408,ag0=-23,$b="String.create",$a="%a = { ",H5="finally",jE="end",aa=255,_$="Buffer",agZ="Oo",agY=364,aey=637,nz="get_def",aex="Pexp_apply\n",Gs="init_class",__="examples.ml",aew="Complex",gr="typing/env.ml",abN="reset_ifthenelse",xL="||",_9=151,H4="@[<1>(%a)@]",_8="lexing: empty token",Gr=-1015195595,abM=-1044071951,Gq="caml_string_get",abL="js_tailcall.ml",Hd="obj_init",nr="typing/typemod.ml",agX=-18,_7=" of ",aev="%a = ATOM(%d)@.",_6="simple_expr",q7=")@.",cH="%a",dL=", ",IO="<=",cV="%a\n",rm="bytecomp/translclass.ml",aeu="%s[%d,%d+%d]",agW="structure_item %a\n",xp=4096,gz="initialiser",jH="class",_5="@;of@;%a",abK="a boolean",H3="%a@.",IN="continue",abJ=503,aet="(%a..%a)",IM="...",_4="Psig_include\n",Hc=400,aes="cache",agV="an integer",xK="caml_int_of_float",bX=" ",w6="Undefined_recursive_module",Hb="output",fc="parsing/pprintast.ml",_3='Pexp_variant "%s"\n',aer="Ppat_or\n",agU="caml_int32_compare",Gp=137,hd=116,aX="bytecomp/matching.ml",agT="send_",w5="Set.bal",hc="()",aeq=1010286124,agS='