Author Topic: MoonScript for Nspire  (Read 6192 times)

0 Members and 1 Guest are viewing this topic.

Offline jmgrosen

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +3/-0
    • View Profile
MoonScript for Nspire
« on: August 14, 2011, 12:08:12 am »
(1st post  ;D)

Has anyone looked into using MoonScript (http://www.moonscript.org) for the Nspire?
It compiles into plain Lua, so it should work fine.
It looks like it has a much better way of handling object-oriented programming.

I'll try it out and see how it goes!

John

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: MoonScript for Nspire
« Reply #1 on: August 14, 2011, 12:10:57 am »
That's very interesting... Keep us posted (pun intended) on how it goes. Good luck! :D

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: MoonScript for Nspire
« Reply #2 on: August 14, 2011, 05:56:26 am »
Woah thanks a lot, this might be better than Lua for some projects, but it'll still compile to Lua and we can then convert to TNS! I just hope it doesn't use any of the Lua things that TI removed, but it should be fine!

Thanks a lot :D

Also, welcome to Omnimaga ;)
« Last Edit: August 14, 2011, 05:57:01 am by ephan »

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: MoonScript for Nspire
« Reply #3 on: August 14, 2011, 12:16:44 pm »
Nice language :) It reminds me the syntax of Groovy. It's a quite new language, isn't it?

But it's suuuuch a pain to install on Windows ... I had to:
- Download luarocks and run install.bat
- Add C:\LuaRocks\bin to the PATH
- Install wget (required by LuaRocks. Why doesn't it integrate it?)
- Add c:\Program Files (x86)\GnuWin32\bin to the PATH
- Install Visual Studio Express because... Moonscript's dependency "lpeg" is built with VC's command "cl"
- Add C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 to the PATH (there are several cl.exe versions in the installation directory, use the one which runs on your computer)
- Install git required by Moonscript's dependency "luafilesystem"
- Add C:\Program Files (x86)\Git\bin to the PATH
- Open the Visual Studio 2010 Express command line prompt for 'cl.exe' to work
- Run luarocks: http://moonscript.org/#installation
- Add C:\LuaRocks\bin to the PATH
- Copy all the .dll files from C:\LuaRocks\lib\lua\5.1 to C:\LuaRocks\bin (strangely "C:\LuaRocks\lib\lua\5.1" is not scanned when loading Lua modules)

And now "moonc test.moon" throws:
Code: [Select]
lua: fatal error: `C:\LuaRocks/share/lua/5.1//alt_getopt.lua:75: attempt to get length of local 'arg' (a nil value)
stack traceback:
        C:\LuaRocks/share/lua/5.1//alt_getopt.lua:75: in function 'get_ordered_opts'
        C:\LuaRocks/share/lua/5.1//alt_getopt.lua:156: in function 'get_opts'
        [string "..."]:11: in main chunk

Any idea? The wierd thing is that I cannot find where alt_getopt is used by Moonlight in its source code.

[edit] get_opts is actually called from inlined Lua code in moonc.exe. Command-line arguments doesn't appear to be correctly propagated to the "arg" variable, may be a Moonscript bug on Windows ?
« Last Edit: August 14, 2011, 01:26:59 pm by ExtendeD »
Ndless.me with the finest TI-Nspire programs

Offline jmgrosen

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +3/-0
    • View Profile
Re: MoonScript for Nspire
« Reply #4 on: August 14, 2011, 05:47:55 pm »
Thanks for the praise!
I've been working on a sudoku solver for the Nspire in Lua, but after seeing this, I decided to re-implement it in Moonscript.
It's working really well for me, though it was relatively hard to install on my 64bit machine.

ExtendeD -- sorry to hear that. My main development platform is Linux (thanks so much for Luna!), so I haven't tried installing it in Windows. (totally off-topic -- are you making progress on Ndless 3.0?)
(edit) It seems someone else has your problem, too: https://github.com/leafo/moonscript/issues/7

Once I get my sudoku solver working I'll post the code + tns as an example, unless you guys want me to post what I've got so far.

John
« Last Edit: August 15, 2011, 12:34:04 pm by jmgrosen »
John

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: MoonScript for Nspire
« Reply #5 on: August 15, 2011, 02:07:48 am »
Yeah, that's a complicated installation procedure indeed.

Quote
(totally off-topic -- are you making progress on Ndless 3.0?)
Such questions are fairly likely to be answered by simple "yes" or "no" - assuming they even receive an answer ;)

History shows that communities aiming at open development on platforms that the manufacturer wants to keep closed (and is taking measures to that aim) are better off when not telling too much information publicly :)
In the Nspire community, not going public too early resulted in glowing hot success last summer, when TI released OS 2.1.0.631 with an anti-downgrade protection. A then-private arbitrary code execution flaw enabled the making and release of Nleash in about two weeks, in the middle of the summer.
« Last Edit: August 15, 2011, 02:26:08 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline jmgrosen

  • LV0 Newcomer (Next: 5)
  • Posts: 4
  • Rating: +3/-0
    • View Profile
Re: MoonScript for Nspire
« Reply #6 on: August 15, 2011, 12:07:30 pm »
But even a yes or a no is better than nothing!  ;)
John

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: MoonScript for Nspire
« Reply #7 on: October 02, 2011, 03:57:08 am »
The author of MoonScript now releases native binaries for Windows which work! http://moonscript.org/bin/
Using it to build TI-Nspire programs is not harder than:
moonc mtest.moon
luna mtest.lua mtest.tns
You should really have a try.
Ndless.me with the finest TI-Nspire programs

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: MoonScript for Nspire
« Reply #8 on: October 02, 2011, 04:51:33 pm »
Awesome !

Definitely going to check this out :)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: MoonScript for Nspire
« Reply #9 on: October 02, 2011, 05:21:05 pm »
Yeah, cant wait :D