- ruby - https://www.ruby-lang.org/en/downloads/
- check:
ruby --version
- check:
- rake - http://rake.rubyforge.org/
- check:
rake --version
- check:
- cmake - http://www.cmake.org/cmake/resources/software.html
- check:
cmake --version
- check:
$ git clone https://github.com/JoshEngebretson/TinyLS.git
$ cd TinyLS/
$ rake build:osx
verify: ls artifacts
should list bin tinylsc tinyrun
(TBD) - ?? copy to /usr/local/bin
?
$ mkdir TinyLsTest && cd TinyLsTest
$ cp -R ../TinyLS/script/libs .
$ mkdir bin
$ mkdir src
$ touch src/TinyLsTest.build
$ touch src/TinyLsTest.ls
TinyLsTest
|`- bin/
|`- libs/
| `- System.loomlib
`- src/
|`- TinyLsTest.build
`- TinyLsTest.ls
TinyLsTest.build
{
"name" : "TinyLsTest",
"version" : "1.0",
"executable" : true,
"outputDir" : "./bin",
"references" : ["System"],
"modules" : [{
"name" : "TinyLsTest",
"version": "1.0",
"sourcePath": ["."]
}]
}
TinyLsTest.ls
package
{
public class TinyLsTest
{
public static function main()
{
trace("Hello from TinyLS!");
trace("PI is", Math.PI);
}
}
}
$ ../TinyLS/artifacts/tinylsc --verbose TinyLsTest.build
LSC - Interpreted Compiler
Building TinyLsTest.build
[loom.compiler.verbose] Parsing src/./TinyLsTest.ls
[loom.compiler] Compiling: TinyLsTest
[loom.compiler.verbose] Type Qualifying Visitor src/./TinyLsTest.ls
[loom.compiler.verbose] Type Member Visitor src/./TinyLsTest.ls
[loom.compiler.verbose] Type Visitor src/./TinyLsTest.ls
[loom.compiler.verbose] Type Validating src/./TinyLsTest.ls
[loom.compiler] Compile Successful: ./bin/TinyLsTest.loom
$ ../TinyLS/artifacts/tinyrun ./bin/TinyLsTest.loom
Bus error: 10
$ gdb ../TinyLS/artifacts/tinyrun
GNU gdb 6.3.50-20050815 (Apple version gdb-1752) (Sat Jan 28 03:02:46 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ........... done
(gdb) run ./bin/TinyLsTest.loom
Starting program: /Users/ellemenno/Projects/TinyLS/artifacts/tinyrun ./bin/TinyLsTest.loom
Reading symbols for shared libraries ++++++++++.............................................................................................................................. done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x00096983 in LS::BinReader::getType ()
(gdb) backtrace
#0 0x00096983 in LS::BinReader::getType ()
#1 0x00095026 in LS::BinReader::readClass ()
#2 0x00095856 in LS::BinReader::readType ()
#3 0x00095a18 in LS::BinReader::readModules ()
#4 0x00095fb4 in LS::BinReader::readAssembly ()
#5 0x00096496 in LS::BinReader::loadExecutable ()
#6 0x0008afd6 in LS::LSLuaState::loadExecutableAssembly ()
#7 0x00004e87 in main ()
import the Math class (see forum post for details)
package
{
import system.Math;
public class TinyLsTest
{
public static function main()
{
trace("Hello from TinyLS!");
trace("PI is", Math.PI);
}
}
}
$ ../TinyLS/artifacts/tinylsc TinyLsTest.build
LSC - Interpreted Compiler
Building TinyLsTest.build
[loom.compiler] Compiling: TinyLsTest
[loom.compiler] Compile Successful: ./bin/TinyLsTest.loom
$ ../TinyLS/artifacts/tinyrun ./bin/TinyLsTest.loom
Hello from TinyLS!
PI is 3.1415926535898