Browse Source

Documentation for JS module.

Vladislav Folts 10 năm trước cách đây
mục cha
commit
f6995f8bbd
3 tập tin đã thay đổi với 29 bổ sung3 xóa
  1. 23 0
      doc/wiki/JS-module.md
  2. 0 0
      doc/wiki/Original-report-refinements.md
  3. 6 3
      doc/wiki/home.md

+ 23 - 0
doc/wiki/JS-module.md

@@ -0,0 +1,23 @@
+*JS* is a built-in pseudo module. It serves as a bridge to JavaScript world from oberon program. The major purpose of this module is to make possible to write bindings to JavaScript libraries.
+
+    MODULE test;
+    IMPORT JS;
+    BEGIN
+        JS.alert("Hello, World!")
+    END test.
+
+You can call any JavaScript function (from global scope) using notation "JS.anyName" and pass any number of any arguments to it. Compiler will not check anything - these are JavaScript rules, all type errors will be raised in runtime.
+
+### JS.do
+
+*JS.do* is a predefined procedure to place specified JavaScript code directly to compiler output.
+
+    JS.do("throw new Error('test')");
+
+### JS.var
+
+*JS.var* is a type to explicit declaration of variables specific for JavaScript code.
+
+    VAR v: JS.var;
+    ...
+    v := JS.someFunction();

+ 0 - 0
doc/wiki/refinements.md → doc/wiki/Original-report-refinements.md


+ 6 - 3
doc/wiki/home.md

@@ -1,5 +1,5 @@
 ### The goal of the project
-I could formulate the goal as "to have traditional static-typed language on the Web". But more realistically it is: to built my own compiler (never did it before but always wanted). Also I wanted to [experiment](https://github.com/vladfolts/oberonjs/wiki/Eberon) with my own language.
+I could formulate the goal as "to have traditional static-typed language on the Web". But more realistically it is: to built my own compiler (never did it before but always wanted). Also I wanted to [[experiment|Eberon]] with my own language.
 
 ### How to use
 You can use the project as any other JavaScript library. There is no third-party dependencies. The project is developing using nodejs so you may have some additional operations to accommodate nodejs source modules in your project. All source code is under src/ folder. Compiler entry point is oc.js.
@@ -14,5 +14,8 @@ To build a test html page locally and see how it works run build.cmd (Python 2.x
 * All included tests are passing.
 * Please report bugs or any deviations from language report.
 
-### [Implementation details](/vladfolts/oberonjs/wiki/Original-report-refinements)
-### [Experiments](/vladfolts/oberonjs/wiki/Eberon)
+### Implementation details
+* [[JS module|JS-module]]
+* [[Report refinements|Original-report-refinements]]
+
+### [[Experiments|Eberon]]