Package: ti842py
ti842py is a TI-BASIC to Python 3 transpiler. A transpiler is a piece of software that can convert code from one language to another. This program should be able to convert a lot of programs, but if you find something that it can't convert yet, start an issue. This transpiler also has the ability to automatically decompile any 8Xp file that you supply as the input file, with the help of my other project that I contribute to,basically-ti-basic. Note that this software is in beta and may produce inaccurate results.FeaturesConverts string literals to commentsAttempts to interpret implicit multiplicationAttempts to fix floating point arithmetic errorsDisp/Output()Variable assignmentIf/Then/Elsestatements, includingElse IfClrHomeInput/PromptFor, While, and Repeat loopsPauseWaitStopDelVargetKeyGoto/LblgetDate,getTime, anddayOfWkIS>(/DS<(Menu()toString()randInt()/randMost drawing functionsList subscriptingMatricesAnsprgmround()Planned FeaturesReturneval()/expr()Known issuesIssues can be found athttps://github.com/TabulateJarl8/ti842py/issuesInstallationti842py can be installed via PyPI or by cloning the repository. To install it with PyPI, just runpip3 install ti842pyin a terminal. To install it locally, you can clone the repository and runpython setup.py install --user.UsageFeel free to use the programs found athttps://github.com/TabulateJarl8/tiprogramsto test this project out.CLI Usageti842py can be used in 3 different ways. The first way is just running it from the command line. For example, if you wanted to convert the program intiprogram.txttotiprogram.py, you can this command:ti842py tiprogram.txt -o tiprogram.py. If no value is specified for-o, the converted program will be written tostdout. The-nflag can be added to force the transpiler to not decompile the input file, and the-dflag can be added to force the transpiler to attempt and decompile the input file. If the--runor-rargument is supplied, the resulting python file will be run after it is done transpilingusage: ti842py [-h] [-o OUTFILE] [-n] [-d] [--no-fix-multiplication] [--no-fix-floating-point] [--turbo-draw] [-r] [-V] [infile]

TI-BASIC to Python 3 Transpiler

positional arguments:
  infile                Input file (filename or stdin).

optional arguments:
  -h, --help            show this help message and exit
  -o OUTFILE, --out OUTFILE
                        Optional output file to write to. Defaults to standard out.
  -n, --force-normal    Forces the program to not attempt and decompile the input file. Useful for false positives
  -d, --force-decompile
                        Forces the program to attempt to decompile the input file
  --no-fix-multiplication
                        Do not attempt to fix implicit multiplication. For example, AB -> A*B and A(1) -> A*(1)
  --no-fix-floating-point
                        Do not attempt to fix floating point arithmetic errors. For example, 1.1 * 3 would normally say 3.3000000000000003 instead of 3.3
  --turbo-draw          Remove the 0.1 second delay between drawing actions
  -r, --run             Runs the program after it's done transpiling. Will not print to stdout
  -V, --version         show program's version number and exitAdvanced terminal usageYou can use ti842py by piping files to it's stdin. This can be done via pipes or redirects, and the files can be either 8Xp or plain text files, just like normal. Here's some examples:$catBAR.8Xp|ti842py--run
$ti842py-obar.py<BAR.8Xp
$catCLOCK.bas|ti842py-nr
$ti842py--no-fix-floating-point--run<CLOCK.basProgrammatic Usageti842py can also be imported and used in a program. Here is an example program to converttiprogram.txttotiprogram.py:fromti842pyimporttranspiletranspile("tiprogram.txt","tiprogram.py")Again, if the second argument is not supplied, the program will be written tostdout. Thetranspilecommand can be supplied with optional arguments.decompileFile,multiplication, andfloating_pointdefault toTrue, andforceDecompile,run, andturbo_drawdefault toFalseThe last way that ti842py can be ran is by running the main python file. After cloning the repository, cd into the repository and runpython ti842py/main.py inputfile.txt. You can supply any arguments that you would supply with theti842pycommand.Special functionsgetKey- ThegetKeyfunction works just like it does in normal TI-BASIC, except with some special rules. Any key on the keyboard pressed will be converted to the corresponding key on the calculator. This works for letters, numbers, arrow keys, enter, delete, and symbols. As for the buttons not on a keyboard, the top 5 keys are the F1-F5 keys on the keyboard,2ndis grave`, andalphais tilda~.modeis F6,statis f7,varsis F8, theX,T,θ,nkey is F9, andclearis backspace.If-Ifblocks withThenafter theIfmust be ended withEnd, they cannot be left open.Ifblocks on 2 lines without aThencannot be closed withEndprgm-prgmwill search the current directory for a file matching the provided name (case insensitive; extension of.8xp). If found, the file will be passed to the commandti842py {filename} --run, where{filename}is the name of the file. If a path is given that contains.or~, or if the path is not all uppercase, the transpiler will assume that the path has been manually provided by the user (this will be useful once I implement a TI-BASIC shell).Libraries usedMy fork of basically-ti-basic- for decompiling.8Xpfilesgraphics.py- for drawing featuresinsignification's fork of the goto module- forgoto/lblsupportpynput- for non-blocking input supportpythondialog- Python wrapper arounddialogforMenusupporttoken_utils- Support for fixing implicit multiplication