Author Topic: TIConvert  (Read 12769 times)

0 Members and 2 Guests are viewing this topic.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: TIConvert
« Reply #30 on: April 23, 2011, 05:53:56 pm »
Well, not much progress.

I've been really busy with a bunch of projects lately (large essay, piano recital, trying to learn javascript (currently fail), trying to organize + make website for robotics club, somehow taking over said robotics club, large math assignment, mandatory school project (unless I don't want to graduate), etc..., all nearly at once)

The detokenizer that I've posted already should be pretty good to use, you should just be able to add it in without much modification (although it's really ugly...).

I'm going to go ahead and give you guys what I have right now, with the understanding that it doesn't work yet + might be overly complicated + is extremely different from previous versions + is written in Python 3.1 and might not work in older Python versions due to differences in how bytes are treated.

I think tokenizing in theory works, but I haven't had time to add in making checksums + generating metadata, and never really completed it.  Detokenizing should also work.

I'll probably resume development in about two weeks to a month (or I might just have to wait until summer).

I'm not too worried about licenses -- this project informally uses the Academic Free License 3.0, but really, I don't care too much about licensing as long as you don't go around claiming you wrote my code, or doing other weird stuff.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TIConvert
« Reply #31 on: April 24, 2011, 08:14:31 am »
Nice to see this is still being worked on. I'll suggest alberthrocks to use this as our tokenizer for Axe GUI Libraries.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TIConvert
« Reply #32 on: May 19, 2011, 04:27:07 pm »
I have now the need to use this program since it's cross-platform and I need to write Axe files in Linux.

The version 0.2 seems to be in .exe and I'm not sure if I can use it the same way as the last one.

I got this when running:

Code: [Select]
david@David-PC ~/Documents/Calculators/TIConvert $ python main_v0_3.py
Traceback (most recent call last):
  File "main_v0_3.py", line 107, in <module>
    (input_path, target_path) = command_info.ReturnPaths(suffix = "_out.txt")
  File "main_v0_3.py", line 67, in ReturnPaths
    input_path = self.arg[0]
IndexError: list index out of range
david@David-PC ~/Documents/Calculators/TIConvert $

Python 2.6.6, Linux Mint 10

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: TIConvert
« Reply #33 on: May 19, 2011, 06:26:51 pm »
You probably never provided an input.

You have to drag the file you want to decompile over the python or exe.  If you don't want to do that, then here's a manual method:

Change
Code: [Select]
# Step 1: Reading arguments from the command line.
command_info = CommandLine()
options = command_info.RunParser()
(input_path, target_path) = command_info.ReturnPaths(suffix = "_out.txt")
into this:
Code: [Select]
# Step 1: Manually providing arguments.
input_path = "directory/folder/THEGAME.8xp"
target_path = "directory/folder/THEGAME_out.txt"'
options = {'tabs': 4, 'quiet': False', 'colons': False}

Basically, that single line runs a command line parser that takes arguments inputted in from the command line, then returns the path of the 8xp you want to decompile, then path you want your output to be.
Alter those two strings to suit your needs.

Alter the 'options' dictionary to suit your needs.  If you want indenting, set 'tabs' equal the the number of spaces you want per indent.  If 'quiet' is set to True, then it won't display any info on the command line/console.  If 'colons' is set to True, then it appends a colon to the start of each line.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TIConvert
« Reply #34 on: May 19, 2011, 06:28:14 pm »
This goes from Axe source to ASM files and other way around?

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: TIConvert
« Reply #35 on: May 19, 2011, 06:33:30 pm »
I know for a fact it can do 8xp source to text file.

I don't think I finished text file to 8xp source, though you could give it a shot.

And I don't even want to try text or source to compiled 8xp (that's what Quigbo's working on, after all :P)
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TIConvert
« Reply #36 on: May 19, 2011, 06:40:28 pm »
I know for a fact it can do 8xp source to text file.

I don't think I finished text file to 8xp source, though you could give it a shot.

And I don't even want to try text or source to compiled 8xp (that's what Quigbo's working on, after all :P)

I know the latter doesn't work obviously. I need the second one.

Michael, I really think you should try and finish this :D

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: TIConvert
« Reply #37 on: July 15, 2011, 11:57:52 am »
A quick update:

I've rewritten it all from scratch (again  <_<) and managed to get both detokenizing and tokenizing working nearly perfect.

All I have left is figuring out how to wrap the metadata around the tokenized part, which shouldn't be too hard (I suppose...)
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: TIConvert
« Reply #38 on: July 15, 2011, 06:17:27 pm »
I finished!

Changes:
> You can convert .txt to .8xp now!
> Switched from Python 3.1 to Python 2.7
> Rewrote everything
> Switched to MIT license
> Fixed some bugs.


Edit:
I don't feel like making another post, so here's a short update.
Changes:
> A bunch of minor code fixes
> The parser can handle broken code a little better
> You can now have the .txt files have fancy output!  (characters like → and λ)
> TI-Basic tokens in .txt files will still compile normally into .8xp files.
> All .dll and other similar files have been compressed into a single .exe file for portability

I'm going to work on support for TI-Basic tomorrow.
« Last Edit: July 17, 2011, 01:05:31 am by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: TIConvert
« Reply #39 on: July 18, 2011, 01:01:17 am »
Sorry, I didn't take the time to read any other posts, but what do you mean by "it probably wouldn't be able to compile" in the OP?

--EDIT--
I have "fancy output" in TBEXE implemented, too (a pain in the butt to find which characters were accounted for, though)! Great minds think alike, I guess ;)
« Last Edit: July 18, 2011, 01:03:15 am by BlakPilar »

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: TIConvert
« Reply #40 on: July 18, 2011, 03:03:06 pm »
Sorry, I didn't take the time to read any other posts, but what do you mean by "it probably wouldn't be able to compile" in the OP?

--EDIT--
I have "fancy output" in TBEXE implemented, too (a pain in the butt to find which characters were accounted for, though)! Great minds think alike, I guess ;)

Ah.  Back then, tokenizing text was very mysterious to me, and I wasn't sure if I was capable of programming such a thing.  Converted text files should have no problem compiling now :D
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: TIConvert
« Reply #41 on: July 18, 2011, 08:27:29 pm »
Sorry, I didn't take the time to read any other posts, but what do you mean by "it probably wouldn't be able to compile" in the OP?

--EDIT--
I have "fancy output" in TBEXE implemented, too (a pain in the butt to find which characters were accounted for, though)! Great minds think alike, I guess ;)

Ah.  Back then, tokenizing text was very mysterious to me, and I wasn't sure if I was capable of programming such a thing.  Converted text files should have no problem compiling now :D


Psh, nahhh. (De)Tokenizing is actually pretty easy once you know which byte belongs to which command lol. But good to hear that it's working on here!

Offline lunixbochs

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 13
  • Rating: +1/-0
    • View Profile
Re: TIConvert
« Reply #42 on: July 18, 2011, 10:24:11 pm »
I just started a Python TI-BASIC implementation a few weeks back. It's actually doing pretty well.

My parser/tokenizer implementation is here
I'm using a list of tokens and simply comparing each token (sorted from longest to shortest) against my position in the text until I find a match, then incrementing my position by the length of the match. It's worked perfectly so far with many tests, and it's extremely fast (5000 lines / 70k characters took <1s to tokenize). If you take away the cruft for expressions and bracket parsing, it might be useful for your purposes :)

This commit has the raw token lists, the current version is all dynamic. The full parser from that commit might actually be useful, as it's the raw version with just string output.

Offline BlakPilar

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 734
  • Rating: +44/-1
    • View Profile
Re: TIConvert
« Reply #43 on: July 18, 2011, 11:23:59 pm »
Hmm... Python, eh? I personally can't deal with Python because it is wwaaayyyyy too loose of a language for me (I need order) lol. That's why I use C#. calccrypto (at least that's his name over on TIBD, not sure what it is here) made an 8xp to txt Python converter that can be found here.

In TBEXE, my detokenizer works perfectly. I just need to stop being lazy and work on my tokenizer :\

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: TIConvert
« Reply #44 on: July 18, 2011, 11:25:03 pm »
AFAIK, calccrypto doesn't have an account on omnimaga.