π
<-
Chat plein-écran
[^]

XPicoC - C interpreter ported to TI-Lua!

Pour TI-Nspire OS 3.0 ou ultérieur.

XPicoC - C interpreter ported to TI-Lua!

Unread postby miyuki_takara » 09 Jun 2020, 15:52

Hello folks,
Today we would like to announce a new project, XPicoC, which turns your TI-Nspire CX into a powerful programming machine in pure C programming language WITHOUT NDLESS! :D

XPicoC is programmed completely in the Lua scripting language and does not depend on any native code, so it can be run on all TI-Nspire OSes from OS 3.2 to the newest OS 5.1, and only slight changes are needed to make it compatible with OS 3.0 and OS 3.1.
We have implemented all the essential features of ISO C, including pointer arithmetic.

Please read the Project GitHub Page for more details about this project.
Project GitHub Page: https://github.com/ExAcler/XPicoC

Usage:
Play with it by directly typing in C statements.
To execute from a C source file:
Create a Notes application and type in or paste your C source code into the application.
Press Ctrl+A followed by Ctrl+C.
Switch back to XPicoC and press Ctrl+V (Or press Menu and select Run > Run code from clipboard)

Screenshots:

Simple Hello World:

Image

Pointer arithmetic:

Image

Quicksort:

Image

Current version of XPicoC is still being tested and may be error prone. A preview version of XPicoC is available to download now:
archives_voir.php?id=2624026

If you are interested you can clone the project and deploy it yourself to get the latest updates.
Last edited by miyuki_takara on 10 Jun 2020, 15:23, edited 3 times in total.
User avatar
miyuki_takara
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 4
Joined: 09 Jun 2020, 15:19
Location: Toronto, Canada
Gender: Male
Calculator(s):
MyCalcs profile
GitHub: ExAcler

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby jean-baptiste boric » 09 Jun 2020, 17:11

Looks cool! Have you made benchmarks against native execution? Also which (if any) platforms APIs do you intend to implement?
User avatar
jean-baptiste boricPremium
Niveau 10: GR (Guide de Référence)
Niveau 10: GR (Guide de Référence)
Level up: 4.5%
 
Posts: 374
Joined: 21 Dec 2015, 22:22
Gender: Not specified
Calculator(s):
MyCalcs profile
GitHub: boricj

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby miyuki_takara » 09 Jun 2020, 17:21

It is way slower than native C execution. This is due to double interpretation: Lua itself interpreted by Native C, and XPicoC is again interpreted by Lua. A sample C code containing only for loops may take 100 times more time than native C to execute. My intention was to make an at least "usable" C interpreter that fully conforms to Texas Instrument's "legality" policy on TI-Nspire programming. Execution efficiency is not the first thing I should consider at this stage.
User avatar
miyuki_takara
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 4
Joined: 09 Jun 2020, 15:19
Location: Toronto, Canada
Gender: Male
Calculator(s):
MyCalcs profile
GitHub: ExAcler

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby miyuki_takara » 09 Jun 2020, 17:26

I am planning to implement gc-related functions in the near future and add a "Graphics Console" page in addition to the current "Command Prompt" page.
Implementing other platform-dependent function should be a breeze.
User avatar
miyuki_takara
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 4
Joined: 09 Jun 2020, 15:19
Location: Toronto, Canada
Gender: Male
Calculator(s):
MyCalcs profile
GitHub: ExAcler

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby Bisam » 10 Jun 2020, 13:43

Are you planning to support execution of code read from a file ?
User avatar
BisamAdmin
Niveau 15: CC (Chevalier des Calculatrices)
Niveau 15: CC (Chevalier des Calculatrices)
Level up: 69.6%
 
Posts: 5665
Joined: 11 Mar 2008, 00:00
Location: Lyon
Gender: Male
Calculator(s):
MyCalcs profile

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby miyuki_takara » 10 Jun 2020, 14:39

TI-Lua does not support reading from a file inside the TI-Nspire filesystem; but it is possible to simulate it inside a TI-Nspire document. If we receive sufficient positive feedback on this project, we may consider implementing a code editor like Jen's Script Editor that is capable of storing C source files, and you will be able to run from these files.
stdio functions are still under development; you will be able to read the contents from a "file" that is indeed stored in a platform variable.
User avatar
miyuki_takara
Niveau 2: MI2 (Membre Initié)
Niveau 2: MI2 (Membre Initié)
Level up: 66.7%
 
Posts: 4
Joined: 09 Jun 2020, 15:19
Location: Toronto, Canada
Gender: Male
Calculator(s):
MyCalcs profile
GitHub: ExAcler


Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby Adriweb » 10 Jun 2020, 17:22

Nspire Lua can "read from files", but those files have to be .tns inside MyLib.

What I did in FormulaPro a long time ago in order to dynamically load external databases relied on that. A LibPub basic function exposed in a tns file in MyLib, that Lua can call (then execute).
See here: https://github.com/adriweb/EEPro-for-Ns ... tabase.lua
Image

MyCalcs: Help the community's calculator documentations by filling out your calculators info!
MyCalcs: Aidez la communauté à documenter les calculatrices en donnant des infos sur vos calculatrices !
Inspired-Lua.org: All about TI-Nspire Lua programming (tutorials, wiki/docs...)
User avatar
AdriwebAdmin
Niveau 16: CC2 (Commandeur des Calculatrices)
Niveau 16: CC2 (Commandeur des Calculatrices)
Level up: 80.3%
 
Posts: 14617
Images: 1218
Joined: 01 Jun 2007, 00:00
Location: France
Gender: Male
Calculator(s):
MyCalcs profile
Twitter: adriweb
GitHub: adriweb

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby Zocipal » 18 Aug 2020, 15:21

Great project, really interesting !
Image
User avatar
ZocipalProgrammeur
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Level up: 60.7%
 
Posts: 113
Joined: 12 Sep 2019, 20:15
Location: Hauts-de-France
Gender: Male
Calculator(s):
MyCalcs profile
Class: 1ère Maths Physique NSI

Re: XPicoC - C interpreter ported to TI-Lua!

Unread postby BackStage » 20 Aug 2020, 02:55

good job thank you :)
User avatar
BackStage
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Level up: 80%
 
Posts: 24
Joined: 03 Apr 2018, 01:54
Gender: Not specified
Calculator(s):
MyCalcs profile


Return to Nspire-Lua

Who is online

Users browsing this forum: No registered users and 21 guests

-
Search
-
Social TI-Planet
-
Featured topics
Comparaisons des meilleurs prix pour acheter sa calculatrice !
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
Phi NumWorks jailbreak
123
-
Donations / Premium
For more contests, prizes, reviews, helping us pay the server and domains...
Donate
Discover the the advantages of a donor account !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partner and ad
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
1434 utilisateurs:
>1421 invités
>8 membres
>5 robots
Record simultané (sur 6 mois):
6892 utilisateurs (le 07/06/2017)
-
Other interesting websites
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)