Download the LimaScriptSDK.zip (Coming soon) and install it.
Create a file called 'HelloWorld.ls' and save it as a ReliableTXT file with UTF-8 encoding and a BOM.
package HelloWorld using Js class App static main(args Array<string>) Window.alert("Hello world") end end
Create a second file called 'HelloWorld.lsproj' and also save it as a ReliableTXT file.
LimaScriptProject Type App Dependencies Internal Js-1.0.2.0 End Files File HelloWorld.ls End End
You should now have the following two files:
HelloWorld.ls HelloWorld.lsproj
Now compile your project with the LimaScript compiler with the following command:
lsc HelloWorld.lsproj
The compiler builds a LimaScript package file and you should now have three files in your project directory.
HelloWorld.ls HelloWorld.lsproj HelloWorld-0.0.0.0.lsp
LimaScript package files always contain the version number in the package name and because we did not specify the version in the project file the compiler assumes a zero version number.
The package file is an SML file, so you can open it and see how the source got compiled. It should look like this:
LimaScriptPackage Dependencies Internal Js-1.0.2.0 Public LimaScript-1.0.0.0 End Types Class Name App Method Name main Type Static Params Param args LimaScript\Array<LimaScript\String> End Begin Expr CallSM Js\Window alert Args 1 String "Hello world" End End End End End
To transpile your package to JavaScript use the LimaScript to JavaScript transpiler with the following command:
ls2js HelloWorld-0.0.0.0.lsp
It will create the following HTML and JS files:
HelloWorld-0.0.0.0.html HelloWorld-0.0.0.0.js
Open the HTML file with your browser. An alert dialog should now open and display the text 'Hello world'.
LimaScript is case insensitive. So rewriting our example completely in upper case, except for the hello world string, produces the same result.
PACKAGE HELLOWORLD USING JS CLASS APP STATIC MAIN(ARGS ARRAY<STRING>) WINDOW.ALERT("Hello world") END END
...