Tiny Pascal Compiler - V1 NOW AVAILABLE!

All aspects of programming on the Commander X16.
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by oodler »

Thanks for the quick reply, it was the one on the first page where I got the .PRG files, I typed it in but think I got it right. Sorry if I didn't:

CONST CR=13; LF=10;
VAR A,B,C,D:INTEGER;
FUNC MAX4(X1,X2,X3,X4);
  FUNC MAX2(X1,X2);
    BEGIN
      IF X1>X2 THEN MAX2:=X1
      ELSE MAX2:=X2
      END;
  BEGIN
    MAX4:=MAX2(MAX2(X1,X2),MAX2(X3,X4))
    END;
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by Martin Schmalenbach »

Ah - thank you!

I’ll take a look tomorrow / today… it’s just about 1am where I am, and time for bed for me!

I wasn’t aware of XVI until you mentioned it - I took a Quick Look at what you’re doing - fantastic!

VI was the first proper text editor I ever used - running on a 68K powered Bleasede Unix box at university, with BBC Micros being used as terminals! We were learning programming in Pascal at the time - this would have been 1986 I think. Happy days!

I’ll be back here when I have something to report!

Cheers

Martin
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by oodler »

No worries, later for me here, also! :) - if you're on discord you can get me there, same username. And thank you, I am not a polyglot by nature, but am looking for languages that can be supported natively on the x16 w/efficient development cycles using just PETSCII. Right now BASIC is and PASCAL (via Tiny Pascal) appear to be the primary ones. This will help me prioritize the many improvements I need to make to XVI. Thank you!
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by Martin Schmalenbach »

Great.

It's been a couple of months since I was working on this, so I need to find the right version - not the latest as that's not quite playing nice...

I notice that both .PRG files I posted have some issues - I wonder if I uploaded the wrong versions.

Anyway, priority #1 is to get the version 1.2 that works - both the compiler and interpreter...
THEN I'll get to work on the issue you identified. It maybe that both are related...

Cheers

Martin
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by oodler »

Sounds great. I am super excited to see what you come up with, no pressure. It's a great companion suite along with XVI and I might finally have proper motivation to learn Pascal - at least a tiny version of it :D. I have list of things to do this weekend with XVI, that's really a shifting set priorities. So I will be around here and on discord.

Cheers!
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by Martin Schmalenbach »

Well, I didn't find V1.2 but I have regenerated it by fixing the bugs - some silly ones - silly enough that I remembered them from before...!

So, I'll do some testing before uploading the new files.

The Blitz compiler is not yet fully working with XC16 specific features, or some of the core features of BASIC V2. However, the state of features of the pCode interpreter does not rely on these missing features, with 3 exceptions, and there is a work-around for that - so I'll also look at having a much faster version of the interpreter up and running too. Should be fun!

Cheers

Martin
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by Martin Schmalenbach »

I'm now at a position to try to replicate your issue.

Can you let me know what you were doing or trying to do in the runup to getting the error you did?
This error is usually generated when the program tries to read past the end of a file it is reading.

If I'm remembering correctly, there was a problem with that version of the compiler in correctly parsing the "END." statement that signifies the formal end of a Pascal program source.

I suspect I discovered that leaving a couple of blank lines at the end of the source file got around this and then I never came back to fix it properly. This is still the case (not fixed!).

I couldn't find the original exact version of the executable that I posted to this forum entry. I do have one very close, so I'll post that version along with the latest version of the interpreter. Hopefully that addresses those problems to your satisfaction for now.

The new versions are posted here (below) and also in the earlier original post in this thread where you downloaded them originally.

Please note that the WRITELN Pascal command is now supported by the compiler.

Cheers

Martin
Attachments
TPX16BASLOADV1.A.PRG
Tiny Pascal Compiler V1.2.2.1
(12.51 KiB) Downloaded 148 times
TPINTERPV1.2.2.PRG
pCode interpreter V1.2.2
(8 KiB) Downloaded 125 times
Last edited by Martin Schmalenbach on Sat Mar 16, 2024 2:21 am, edited 2 times in total.
User avatar
ahenry3068
Posts: 1136
Joined: Tue Apr 04, 2023 9:57 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by ahenry3068 »

Martin Schmalenbach wrote: Fri Mar 15, 2024 11:12 pm
I suspect I discovered that leaving a couple of blank lines at the end of the source file got around this and then I never came back to fix it properly. This is still the case (not fixed!).
I suspect your problem is that CBM DOS reports EOF as soon as the last byte is read, rather than on the next read. Most systems don't report EOF until you go past that last Byte. It's pretty easy to account for though once you know what is happening.

Tony
Martin Schmalenbach
Posts: 140
Joined: Tue Jul 21, 2020 10:08 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by Martin Schmalenbach »

Thanks Tony - that's EXACTLY what is happening... and when you stop and think about it - that's the best way to do it really!

I have updated / uploaded the fixed version of the compiler - V1.2.2.1 - this is in both previous posts where I had linked to the various executables.
oodler
Posts: 21
Joined: Mon Dec 18, 2023 4:37 pm

Re: Tiny Pascal Compiler - V1 NOW AVAILABLE!

Post by oodler »

Martin Schmalenbach wrote: Sat Mar 16, 2024 2:15 am Thanks Tony - that's EXACTLY what is happening... and when you stop and think about it - that's the best way to do it really!

I have updated / uploaded the fixed version of the compiler - V1.2.2.1 - this is in both previous posts where I had linked to the various executables.
Awesome, I am eager to give this a try and will report back. May not be immediate, but it's definitely on my TO DO list. TY!
Post Reply