Version 1.0 now posted in Development Tools.
Pascal-S
Forum rules
This is the only download category to upload works in progress of your application or game.
This is the only download category to upload works in progress of your application or game.
Re: Pascal-S
For anyone trying this and having problems, today I discovered a bug, but one that occurs for unknown reasons, which I haven't figured out. What will happen is that the compiler will parse the source text, apparently completely, but then just sit there. It appears to hang on the terminating 'end.', adding another 'end.' appears to fix it. I spent a number of hours trying to figure out why it happens, without success. As I say, it doesn't always happen, but if you see these symptoms and don't find any other 'syntax' errors, try adding a second 'end.'.
Also, the interpreter executes the program and when the program is finished, the interpreter exits, so you need a readln(); or forever loop at the end of your code, to see the results.
Also, the interpreter executes the program and when the program is finished, the interpreter exits, so you need a readln(); or forever loop at the end of your code, to see the results.
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Pascal-S
Even with the limitations and remaining bugs, I applaud you for getting this far. I'm thoroughly amazed that you managed to use Prog8 to write a compiler for Pascal and get it more or less working.
Re: Pascal-S
Thanks Desertfish! I'm sure someone more knowledgeable could do a better job, but it's an interesting project! Not completely understanding the code is a big hindrance! I know more now, than at the start, but....I'm probably not detail oriented enough to really nail it down. Prog8 is very capable and well supported!
I have a fix...for the previous issue and will post an update soon.
I have a fix...for the previous issue and will post an update soon.
Re: Pascal-S
I was hoping to have remarks working, but it continues to evade me. Here is a new updated version (in original post) , some fixes and enhancements. A few new 'standard functions' added to make all of the 'non' Pascal standard function/procedures:
Call - call a kernal routine
Clear - clear text screen
Rand - return a random number between 0-255
A few new examples to demonstrate the new function/procedures.
Here's a minor question. I made write/writeln use the double quote instead of the single quote, since that's the 'norm' for the Commodore lineage, should I change it to use single quotes?
Call - call a kernal routine
Clear - clear text screen
Rand - return a random number between 0-255
A few new examples to demonstrate the new function/procedures.
Here's a minor question. I made write/writeln use the double quote instead of the single quote, since that's the 'norm' for the Commodore lineage, should I change it to use single quotes?
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Pascal-S
Long time Pascal programmer here. Pretty new to the "Commodore" way of doing things. My introduction to things Commodore IS the X16. That being said. Pascal has always been single quotes for string literals in any implementation I have seen.yock1960 wrote: ↑Mon Jan 15, 2024 8:31 pm I was hoping to have remarks working, but it continues to evade me. Here is a new updated version (in original post) , some fixes and enhancements. A few new 'standard functions' added to make all of the 'non' Pascal standard function/procedures:
Call - call a kernal routine
Clear - clear text screen
Rand - return a random number between 0-255
A few new examples to demonstrate the new function/procedures.
Here's a minor question. I made write/writeln use the double quote instead of the single quote, since that's the 'norm' for the Commodore lineage, should I change it to use single quotes?
- ahenry3068
- Posts: 1136
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Pascal-S
Also GotoXY is NOT a standard Pascal function in the ISO sense. But it feels like a standard function to anyone coming from Turbo Pascal. Should be a rather simple implementation. Just pass the parameters to the ROM Plot routine.
Re: Pascal-S
If I can figure out how to get multiple parameters 'coded' in the compiler, I'll add this. It's certainly accounted for in the compiler, since read(ln)/write(ln) handle multiple parameters, but so far I've only added stuff with either 0 or 1 parameters.ahenry3068 wrote: ↑Tue Jan 16, 2024 2:17 am Also GotoXY is NOT a standard Pascal function in the ISO sense. But it feels like a standard function to anyone coming from Turbo Pascal. Should be a rather simple implementation. Just pass the parameters to the ROM Plot routine.
I guess I should dive into the Turbo Pascal book that I have to see what symbols or words they use for bitwise operations, since that's what I'm about to try to add.
This certainly won't adhere to any ISO standards, but I'll try to behave if I can.
Re: Pascal-S
The three C64 Pascal's that I have seen manual's for all use single quotes, so I'd stick with single quotes. When you see things to type in with double quotes, and look closer, that is always using Basic to load and run programs or to manage files, not Pascal source.ahenry3068 wrote: ↑Tue Jan 16, 2024 2:15 amLong time Pascal programmer here. Pretty new to the "Commodore" way of doing things. My introduction to things Commodore IS the X16. That being said. Pascal has always been single quotes for string literals in any implementation I have seen.yock1960 wrote: ↑Mon Jan 15, 2024 8:31 pm I was hoping to have remarks working, but it continues to evade me. Here is a new updated version (in original post) , some fixes and enhancements. A few new 'standard functions' added to make all of the 'non' Pascal standard function/procedures:
Call - call a kernal routine
Clear - clear text screen
Rand - return a random number between 0-255
A few new examples to demonstrate the new function/procedures.
Here's a minor question. I made write/writeln use the double quote instead of the single quote, since that's the 'norm' for the Commodore lineage, should I change it to use single quotes?
Re: Pascal-S
Here is the latest build of Pascal-S. I have added the keyword/command 'GOTOXY', which will enable positioning the text cursor for text output. I also changed from double quotes to single quotes inside writeln. Additionally, I added being able to perform bitwise 'and' using the & symbol. I think that Turbo Pascal used 'and' for both boolean and bitwise operations, but this was the easiest path for me. I will be adding or,xor, and shifts. I will use SHR and SHL for the shifts. I have included a program that showcases these new features.
Updated p-compile.prg and p-interpret.prg are in the .zipfile in the post at top.
Updated p-compile.prg and p-interpret.prg are in the .zipfile in the post at top.