Jump to content
IGNORED

Basic Parsing and Transformation Tool - New Version


dmsc

Recommended Posts

Hi!,

 

Your program is mindblowing... :-o

Thanks!

 

Had some tests with my new tenliner wip. Your program don't like my program :) . The parser expects a string in the TEXT command, but I want to print it a number through a variable: TEXT 60,0,VAR

Fixes this and other minor errors:

- Parsing of *F / *B / *L with +/-.

- Parser could crash with invalid counts in extended strings.

- Bogus error in some cases with extended strings.

- Parsing of CIRCLE with 4 parameters (ellipses).

- Parsing of TEXT with a numeric argument instead of string.

 

As always, download the new release at github: https://github.com/dmsc/tbxl-parser/releases/tag/v9.2

  • Like 4
Link to comment
Share on other sites

Great!!

 

Now I am struggling with Atari special characters like inverse characters or graphics characters.

I want to program in a windows text editor and parse it to tokenized turbo basic program. If I haven't overseen anything then it is not possible.

Perhaps the ATASCI code in square brackets could be translated (parsed/transformed/...) to the special character in the tokenized basic file?

[0] would become the heart character and [160] would become inverse space for example. The square brackets are barely used and could function as signal characters.

Link to comment
Share on other sites

Hi!,

 

Great!!

 

Now I am struggling with Atari special characters like inverse characters or graphics characters.

I want to program in a windows text editor and parse it to tokenized turbo basic program. If I haven't overseen anything then it is not possible.

Perhaps the ATASCI code in square brackets could be translated (parsed/transformed/...) to the special character in the tokenized basic file?

[0] would become the heart character and [160] would become inverse space for example. The square brackets are barely used and could function as signal characters.

heeeey, this is a basic functionality of dmsc tool!

Just type "\AF\00\9B" and you are good. And look up https://github.com/dmsc/tbxl-parser :)))))

Yes!, you can also use "extended strings", like:

 

 print ["{clr} Press ~START~ to continue. "]
This will be converted to a character 125 (clear screen) and the "START" to inverse video.

 

See another example at https://github.com/dmsc/tbxl-parser/blob/master/samples/sample-3.txt

Link to comment
Share on other sites

I'd like to try this — it looks amazing and I'm having real trouble this year with the tokenizer in TBXL (a problem I haven't had in previous contests.) But I use a Mac and don't see a macos build. (I downloaded it and tried to just "make" but that didn't work, and anyway I'm lazy.) Is there a Mac build?

 

Thanks

Link to comment
Share on other sites

Hi!,

 

I'd like to try this it looks amazing and I'm having real trouble this year with the tokenizer in TBXL (a problem I haven't had in previous contests.) But I use a Mac and don't see a macos build. (I downloaded it and tried to just "make" but that didn't work, and anyway I'm lazy.) Is there a Mac build?

 

Thanks

Sorry, I don't have a Mac and don't know of any Linux based cross-compiler available, so can't build here.

 

But, here is a source version with all generated C sources already built, this should be easier to compile by just typing make.

 

I recommend using the command:

  make CC=gcc CROSS= EXT= CFLAGS='-Wall -O2 -flto -DNDEBUG' dist
If your compiler is not "gcc", replace it in the "CC=" part and remove the "-flto" (link-time-optimization) if it does not work.

 

After compilation, the above command will generate an output ZIP file (if the zip utility is in the PATH) with the executable, README, samples and license files.

 

If the make command does not work, the last resort is simply calling the compiler directly:

  gcc -Wall -O2 -DNDEBUG -Ibuild/src src/ataribcd.c src/basexpr.c src/basic.c src/baswriter.c src/convertbas.c src/darray.c src/defs.c src/expr.c src/lister.c src/listexpr.c src/main.c src/optconst.c src/optconstvar.c src/optimize.c src/optlinenum.c src/optrmvars.c src/parser.c src/procparams.c src/program.c src/sbuf.c src/vars.c build/src/statements.c build/src/tokens.c -o basicParser -lm
The above command will produce an executable "basicParser" directly in the base directory. Note that not all C files are in the above command line, so simply "build/src/*.c" does not work.

basicParser-source-v9.2.0.zip

Link to comment
Share on other sites

Hi!,

 

I compiled directly with Mac OS X and it worked, though I haven't test it much

If you can post here the generated ZIP file (or the executable only), I can upload it to the github page, so it is available for anyone.

 

Thanks,

Link to comment
Share on other sites

I had the following warnings:

$ make >> stdout.txt
fatal: Not a git repository (or any of the parent directories): .git
In file included from src/basic.c:50:
build/src/basic_peg.c:10200:1: warning: unused label 'l453' [-Wunused-label]
l453:;
^~~~~
build/src/basic_peg.c:242:15: warning: unused function 'yyAccept'
      [-Wunused-function]
YY_LOCAL(int) yyAccept(yycontext *yy, int tp0)
              ^
2 warnings generated.

When I check the version, I get:

(no version at all)

$ ./basicParser -help
TurboBasic XL parser tool - version
https://github.com/dmsc/tbxl-parser

Usage: ./basicParser [options] filename
    -l  Output long (readable) program.
    -b  Output binary (.BAS) program. (default)
    -s  Output short listing program.
    -n  In short listing, sets the max line length before splitting (120).
    -f  Output full (long) variable names in binary output.
    -x  Makes binary output protected (un-listable).
    -a  In long output, convert comments to pure ASCII.
    -v  Shows more parsing information (verbose mode).
    -q  Don't show parsing information (quiet mode).
    -o  Sets the output file name or extension (if starts with a dot).
    -c  Output to standard output instead of a file.
    -O  Defaults to run the optimizer in the parsed program.
    -h  Shows help and exit.

basicParser-source-v9.2.0-macosx.zip

Link to comment
Share on other sites

Hi!,

 

I had the following warnings:

$ make >> stdout.txt
fatal: Not a git repository (or any of the parent directories): .git
In file included from src/basic.c:50:
build/src/basic_peg.c:10200:1: warning: unused label 'l453' [-Wunused-label]
l453:;
^~~~~
build/src/basic_peg.c:242:15: warning: unused function 'yyAccept'
      [-Wunused-function]
YY_LOCAL(int) yyAccept(yycontext *yy, int tp0)
              ^
2 warnings generated.

The two warnings are expected, this is the code generated by PEG, so I can't modify it.

When I check the version, I get:

(no version at all)

$ ./basicParser -help
TurboBasic XL parser tool - version
https://github.com/dmsc/tbxl-parser

 

Yes, I missed that the makefile uses GIT to generate the version string, a shame but the binary should work.

 

I built and uploaded a binary archive to github, see at: https://github.com/dmsc/tbxl-parser/releases/tag/v9.2

 

Thanks again!

Link to comment
Share on other sites

Thank you for the Mac binary — I've been able to test the program, and it shows promise! But now a problem.

 

I ran my program through basicParser to create a BAS file, but when I try to LOAD it back into the Atari, I get ERROR- 140 NOT IMPL AT LINE 0.

 

I did it again, creating a LST file — when I do ENTER"D: ... same thing, NOT IMPL.

 

I don't know why, or what to do to fix it. What's not implemented?

 

My original first line:

DIM L(4),M(4),F$(40),Z$(4):F$="EIMR3IRI3RIRIJJRI3JR":FOR X=1 TO 5:L(X-1)=20*X+X:NEXT X:Q=500

 

The parsed version:

0DIMA(4),B(4),A$(40),B$(4):A$="EIMR3IRI3RIRIJJRI3JR":F.A=1TO5:A(A-1)=20*A+A:N.A:B=500

 

I tried again with -f to preserve my variable names, and got ERROR- 140 NOT IMPL AT LINE 100.

 

help?

 

Thanks

Kevin

Link to comment
Share on other sites

Hi!,

 

Thank you for the Mac binary I've been able to test the program, and it shows promise! But now a problem.

 

I ran my program through basicParser to create a BAS file, but when I try to LOAD it back into the Atari, I get ERROR- 140 NOT IMPL AT LINE 0.

 

I did it again, creating a LST file when I do ENTER"D: ... same thing, NOT IMPL.

 

I don't know why, or what to do to fix it. What's not implemented?

 

My original first line:

DIM L(4),M(4),F$(40),Z$(4):F$="EIMR3IRI3RIRIJJRI3JR":FOR X=1 TO 5:L(X-1)=20*X+X:NEXT X:Q=500

 

The parsed version:

0DIMA(4),B(4),A$(40),B$(4):A$="EIMR3IRI3RIRIJJRI3JR":F.A=1TO5:A(A-1)=20*A+A:N.A:B=500

 

I tried again with -f to preserve my variable names, and got ERROR- 140 NOT IMPL AT LINE 100.

 

help?

 

Thanks

Kevin

There are a few strange thinks in your example:

- Your program works here, both as saved ".BAS" or as listed ".LST".

- Error 140 is "serial bus error".

- "NOT IMPL" is error 146.

 

So, both errors are SIO errors, not BASIC errors. My guess is that you are LOADing or ENTERing the program with a bad file name, or no DOS.

 

Normally, you should type LOAD "D:MYPROG.BAS" or ENTER "D:MYPROG.LST"

Link to comment
Share on other sites

You're right, it was error 146 — I mistyped it.

 

I've narrowed the problem: I can't do ANYTHING with those files, even delete them in DOS, on the Atari. Something about using Atari800MacX to import the files from the Mac is creating invalid files.

 

Aaaargh.

 

thanks

-K

post-803-0-47214500-1453652198_thumb.png

Link to comment
Share on other sites

I've gotten everything working, and wow — the Basic Parsing and Transformation Tool is amazing. Well done! It is already changing how I code 10-liners for the better.

 

(Now I wish Atari800Mac X had hooks to make it automatic to import and run files created with BPTT.)

Link to comment
Share on other sites

hello dmsc

 

just a humble feature request to mighty $incbin directive:

$incbin *defineName$* , "*fileName*"

could you pls extend it similarly to mads "INS" command:

INS 'filename'["filename"][*][+-value][,+-ofset[,length]]
The INS pseudo-command allows inclusion of an external binary file. The included file does not have to be in the same directory as the main file being assembled. Search paths for the file can be configurated using the /i switch (see assembly switches).
Additionally, you can perform the following operations on the binary data:
* invert bytes
+-VALUE increase or decrease each byte by the value of the expression VALUE
+OFSET skip OFSET bytes at the beginning of the file (seek to OFSET)
-OFSET read OFSET bytes at the end of the file (seek to FileLength-OFSET)
LENGTH read LENGTH bytes from the file
If the LENGTH value is not specified, the default behavior is to read to the end.

Definitely a sufficient addition would be:

$incbin *defineName$* , "*fileName*", OFFSET, LENGTH

(skip OFFSET bytes and read LENGTH bytes).

 

It would make it possible to e.g. include a whole font from one file to a bunch of variables. Also including (bmp) and other _almost_ plain picture format would be easier.

Link to comment
Share on other sites

Hi!,

 

hello dmsc

 

just a humble feature request to mighty $incbin directive:

$incbin *defineName$* , "*fileName*"
could you pls extend it similarly to mads "INS" command:

INS 'filename'["filename"][*][+-value][,+-ofset[,length]]
The INS pseudo-command allows inclusion of an external binary file. The included file does not have to be in the same directory as the main file being assembled. Search paths for the file can be configurated using the /i switch (see assembly switches).
Additionally, you can perform the following operations on the binary data:
* invert bytes
+-VALUE increase or decrease each byte by the value of the expression VALUE
+OFSET skip OFSET bytes at the beginning of the file (seek to OFSET)
-OFSET read OFSET bytes at the end of the file (seek to FileLength-OFSET)
LENGTH read LENGTH bytes from the file
If the LENGTH value is not specified, the default behavior is to read to the end.
Definitely a sufficient addition would be:

$incbin *defineName$* , "*fileName*", OFFSET, LENGTH
(skip OFFSET bytes and read LENGTH bytes).

 

It would make it possible to e.g. include a whole font from one file to a bunch of variables. Also including (bmp) and other _almost_ plain picture format would be easier.

 

Ok, here is a new version with optional "OFFSET" and "LENGTH" added to the $incbin directive: https://github.com/dmsc/tbxl-parser/releases/tag/v9.3

 

Please, test the new version and review the "README.md" ;)

  • Like 1
Link to comment
Share on other sites

hello dmsc,

 

incbin works like a charm now, so i've got another, quite bold request this time. it would be really nice to be able to type:

$incbin sprite$, "char6.fnt", (16+5)*8, 12*8

instead of

$incbin sprite$, "char6.fnt", 176, 96

i reckon this ain't no easy, but i see in README.md

  poke @PCOLR0+2, $1F   : ' Replaced by: POKE 706,31

so you basically have some arithmetic already.

 

best,

pirx

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...