Oppolzer - Informatik / Stanford Pascal Compiler


Home       Lebenslauf       Schwerpunkte       Kenntnisse       Seminare       Kunden       Projekte       Produkte       Blog       Stanford Pascal       Kontakt

The Stanford Pascal Compiler / Evolution Steps

Back to Compiler main page

Shorter string constants - continued

I started to convert a useful program to Stanford Pascal that compares text files and prints the differences, in much the same way as the CMS command COMPARE does it, but much better, because, when finding a difference, it tries to synchronize on the next line which is equal, this way minimizing the shown differences (much the same way as SuperC and other compare tools do it).

This program is written in Ansi C and it is freeware; I found it somewhere in the Internet some years ago and adopted and improved it to meet my own needs. Now I wanted to convert it to Stanford Pascal, as an exercise, and: to see what features are still missing in the language.

I realized that the BREAK, CONTINUE and RETURN statements are very useful; I used them in the compiler, too, in the meantime, when indentation was large and they make the code more readable, IMO.

But I realized, too, that my extensions regarding shorter strings were incomplete:

So I had to do more work to fix all those shortcomings, but now it all works.

There remains one more problem: char string constants are limited to 64 bytes, which is not enough, IMO. Of course, because char string constants may not span source lines at the moment, this seems no big problem, but this also limits the size of char arrays that can be made compatible to shorter string constants; that is: a char array of, say, length 256 cannot be initialized by a single blank. This is because the initializing constant has to be expanded to 256 chars and written to the P-Code intermediate file in this expanded length, and this is not possible, at the moment.

So if you try to initialize strings having lengths > 64 with shorter string constants, you will get the same syntax error E129 (type conflict) as before my extensions. I would like to improve this in a future release.

Back to Compiler main page