Scott:
I don't understand the difference between p4 and p5. I see p6 is under development. If I try it, should I use:
Pascal-P4 is a Pascal subset. Pascal-P5 is full ISO 7185. Pascal-P6 is an extended Pascal. P5 is 1.3, so yes, pascal-p5_1_3.tar.gz.
Ok, thanks!
I got
https://sourceforge.net/projects/pascalp5/files/pascal-p5_1_3.tar.gz/downloa...
There is no mention of macOS in the README.
The README says:
The full instructions for running and setting up the P5 compiler/interpreter have all been incorporated into the document:
doc/the_p5_compiler.docx
Which is a Microsoft Word document, 2007 or later. it is also available in the formats:
doc/the_p5_compiler.pdf Adobe Portable Document Format. doc/the_p5_compiler.html Web page format. doc/the_p5_compiler.doc Word 1997-2003 format.
Please consult one of these documents for full instructions on how to use P5.
But that's not true. The doc/ diretory only contains:
The_Programming_Language_Pascal_1973.pdf basic.docx iso7185rules.html the_p5_compiler.docx
The_Programming_Language_Pascal_1973.pdf is great to have a copy of!
I used libreoffice to convert to pdf:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf basic.docx
2 Beta software warning p5 Basic is beta software at this time (version <1). It should not be considered reliable for production use.
Oh my. Looks like your documentation may be out of date. Is this still beta despite version > 1?
Convert the other docx:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf the_p5_compiler.docx
This one is dated August 29, 2014 and on page 14 it says:
Is P5 a sueable compiler for real applications? I would assert that it is not.
That's no good!
./setpath ./configure make
% ./setpath ./setpath: Permission denied.
You have the windows setpath.bat but have not set the permissions on setpath correctly. % chmod u+x setpath
egg 320% ./configure ./configure: Command not found.
% chmod a+rx configure % ls -l configure -rwxr-xr-x 1 schneidt admin 6469 Jan 5 2018 configure* % ./configure ./configure: Command not found. %
This is really weird.
Please set it up to work on macOS.
Tom
Thomas D. Schneider, Ph.D. Senior Investigator National Institutes of Health National Cancer Institute Center for Cancer Research RNA Biology Laboratory Biological Information Theory Group Frederick, Maryland 21702-1201 schneidt@mail.nih.gov https://alum.mit.edu/www/toms
The P5 archive tries very hard to work equally on both Windows and Linux. Looking at the 1.3 archive, the Linux files weren't correctly set up for linux, which involves changing the line endings to be correct for that system (the standard CRLF or LF only issue between these systems).
We have having rolling blackouts here in CA, so I am delayed fixing this. I'll try to fix the archive by tonight.
Regards,
Scott Franco
--------- Original Message --------- Subject: Re: Plan to Update GPC From: "Schneider, Thomas (NIH/NCI) [E]" schneidt@mail.nih.gov Date: 8/15/20 10:34 am To: "scott andrew franco" samiam@moorecad.com Cc: "gpc@gnu.de" gpc@gnu.de
Scott:
I don't understand the difference between p4 and p5. I see p6 is under development. If I try it, should I use:
Pascal-P4 is a Pascal subset. Pascal-P5 is full ISO 7185. Pascal-P6 is an extended Pascal. P5 is 1.3, so yes, pascal-p5_1_3.tar.gz.
Ok, thanks!
I got
https://sourceforge.net/projects/pascalp5/files/pascal-p5_1_3.tar.gz/downloa...
There is no mention of macOS in the README.
The README says:
The full instructions for running and setting up the P5 compiler/interpreter have all been incorporated into the document:
doc/the_p5_compiler.docx
Which is a Microsoft Word document, 2007 or later. it is also available in the formats:
doc/the_p5_compiler.pdf Adobe Portable Document Format. doc/the_p5_compiler.html Web page format. doc/the_p5_compiler.doc Word 1997-2003 format.
Please consult one of these documents for full instructions on how to use P5.
But that's not true. The doc/ diretory only contains:
The_Programming_Language_Pascal_1973.pdf basic.docx iso7185rules.html the_p5_compiler.docx
The_Programming_Language_Pascal_1973.pdf is great to have a copy of!
I used libreoffice to convert to pdf:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf basic.docx
2 Beta software warning p5 Basic is beta software at this time (version <1). It should not be considered reliable for production use.
Oh my. Looks like your documentation may be out of date. Is this still beta despite version > 1?
Convert the other docx:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf the_p5_compiler.docx
This one is dated August 29, 2014 and on page 14 it says:
Is P5 a sueable compiler for real applications? I would assert that it is not.
That's no good!
./setpath ./configure make
% ./setpath ./setpath: Permission denied.
You have the windows setpath.bat but have not set the permissions on setpath correctly. % chmod u+x setpath
egg 320% ./configure ./configure: Command not found.
% chmod a+rx configure % ls -l configure -rwxr-xr-x 1 schneidt admin 6469 Jan 5 2018 configure* % ./configure ./configure: Command not found. %
This is really weird.
Please set it up to work on macOS.
Tom
Thomas D. Schneider, Ph.D. Senior Investigator National Institutes of Health National Cancer Institute Center for Cancer Research RNA Biology Laboratory Biological Information Theory Group Frederick, Maryland 21702-1201 schneidt@mail.nih.gov https://alum.mit.edu/www/toms
I fixed up the line endings and put the archive back in Pascal-p5_1_3.tar.gz.
It works better,but there is still something wrong with it, and it only happens on the linux version.
>>>>>>>>>>>>>>>>>>>>>>>>
amiam@samiam-home-pc:~/scratch/pascal-p5/sample_programs$ p5 hello Compiling and running hello P5 Pascal compiler vs. 1.3 Pascal-P5 complies with the requirements of level 0 of ISO/IEC 7185.
1 -56 program hello(output); 2 -56 3 -56 begin 4 3 5 3 writeln('Hello, world') 6 11 7 11 end. Errors in program: 0 P5 Pascal interpreter vs. 1.3 Assembling/loading program Running program Hello, world *** Runtime error [7]: Stack balance program complete <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< As you can tell, it didn't get that much testing on linux, more on windows.
I'll look into it.
Scott Franco
--------- Original Message --------- Subject: RE: Re: Plan to Update GPC From: "scott andrew franco" samiam@moorecad.com Date: 8/17/20 2:28 pm To: "Schneider, Thomas (NIH/NCI) [E]" schneidt@mail.nih.gov Cc: "gpc@gnu.de" gpc@gnu.de
The P5 archive tries very hard to work equally on both Windows and Linux. Looking at the 1.3 archive, the Linux files weren't correctly set up for linux, which involves changing the line endings to be correct for that system (the standard CRLF or LF only issue between these systems).
We have having rolling blackouts here in CA, so I am delayed fixing this. I'll try to fix the archive by tonight.
Regards,
Scott Franco
--------- Original Message --------- Subject: Re: Plan to Update GPC From: "Schneider, Thomas (NIH/NCI) [E]" schneidt@mail.nih.gov Date: 8/15/20 10:34 am To: "scott andrew franco" samiam@moorecad.com Cc: "gpc@gnu.de" gpc@gnu.de
Scott:
I don't understand the difference between p4 and p5. I see p6 is under development. If I try it, should I use:
Pascal-P4 is a Pascal subset. Pascal-P5 is full ISO 7185. Pascal-P6 is an extended Pascal. P5 is 1.3, so yes, pascal-p5_1_3.tar.gz.
Ok, thanks!
I got
https://sourceforge.net/projects/pascalp5/files/pascal-p5_1_3.tar.gz/downloa...
There is no mention of macOS in the README.
The README says:
The full instructions for running and setting up the P5 compiler/interpreter have all been incorporated into the document:
doc/the_p5_compiler.docx
Which is a Microsoft Word document, 2007 or later. it is also available in the formats:
doc/the_p5_compiler.pdf Adobe Portable Document Format. doc/the_p5_compiler.html Web page format. doc/the_p5_compiler.doc Word 1997-2003 format.
Please consult one of these documents for full instructions on how to use P5.
But that's not true. The doc/ diretory only contains:
The_Programming_Language_Pascal_1973.pdf basic.docx iso7185rules.html the_p5_compiler.docx
The_Programming_Language_Pascal_1973.pdf is great to have a copy of!
I used libreoffice to convert to pdf:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf basic.docx
2 Beta software warning p5 Basic is beta software at this time (version <1). It should not be considered reliable for production use.
Oh my. Looks like your documentation may be out of date. Is this still beta despite version > 1?
Convert the other docx:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf the_p5_compiler.docx
This one is dated August 29, 2014 and on page 14 it says:
Is P5 a sueable compiler for real applications? I would assert that it is not.
That's no good!
./setpath ./configure make
% ./setpath ./setpath: Permission denied.
You have the windows setpath.bat but have not set the permissions on setpath correctly. % chmod u+x setpath
egg 320% ./configure ./configure: Command not found.
% chmod a+rx configure % ls -l configure -rwxr-xr-x 1 schneidt admin 6469 Jan 5 2018 configure* % ./configure ./configure: Command not found. %
This is really weird.
Please set it up to work on macOS.
Tom
Thomas D. Schneider, Ph.D. Senior Investigator National Institutes of Health National Cancer Institute Center for Cancer Research RNA Biology Laboratory Biological Information Theory Group Frederick, Maryland 21702-1201 schneidt@mail.nih.gov https://alum.mit.edu/www/toms _______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc
I fixed it up.
From this I gather:
1. It was never tested on 64 bit Linux. It was tested on Windows.
2. That's probably not the only thing that might not work on 64 bit linux.
Sorry about that. That version is actually quite old. Its better to use the tip version from git. I am presently working towards a release of that.
Scott Franco
--------- Original Message --------- Subject: RE: Re: Plan to Update GPC From: "scott andrew franco" samiam@moorecad.com Date: 8/17/20 11:40 pm To: "Schneider, Thomas (NIH/NCI) [E]" schneidt@mail.nih.gov Cc: "gpc@gnu.de" gpc@gnu.de
I fixed up the line endings and put the archive back in Pascal-p5_1_3.tar.gz.
It works better,but there is still something wrong with it, and it only happens on the linux version.
>>>>>>>>>>>>>>>>>>>>>>>>
amiam@samiam-home-pc:~/scratch/pascal-p5/sample_programs$ p5 hello Compiling and running hello P5 Pascal compiler vs. 1.3 Pascal-P5 complies with the requirements of level 0 of ISO/IEC 7185.
1 -56 program hello(output); 2 -56 3 -56 begin 4 3 5 3 writeln('Hello, world') 6 11 7 11 end. Errors in program: 0 P5 Pascal interpreter vs. 1.3 Assembling/loading program Running program Hello, world *** Runtime error [7]: Stack balance program complete <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< As you can tell, it didn't get that much testing on linux, more on windows.
I'll look into it.
Scott Franco
--------- Original Message --------- Subject: RE: Re: Plan to Update GPC From: "scott andrew franco" samiam@moorecad.com Date: 8/17/20 2:28 pm To: "Schneider, Thomas (NIH/NCI) [E]" schneidt@mail.nih.gov Cc: "gpc@gnu.de" gpc@gnu.de
The P5 archive tries very hard to work equally on both Windows and Linux. Looking at the 1.3 archive, the Linux files weren't correctly set up for linux, which involves changing the line endings to be correct for that system (the standard CRLF or LF only issue between these systems).
We have having rolling blackouts here in CA, so I am delayed fixing this. I'll try to fix the archive by tonight.
Regards,
Scott Franco
--------- Original Message --------- Subject: Re: Plan to Update GPC From: "Schneider, Thomas (NIH/NCI) [E]" schneidt@mail.nih.gov Date: 8/15/20 10:34 am To: "scott andrew franco" samiam@moorecad.com Cc: "gpc@gnu.de" gpc@gnu.de
Scott:
I don't understand the difference between p4 and p5. I see p6 is under development. If I try it, should I use:
Pascal-P4 is a Pascal subset. Pascal-P5 is full ISO 7185. Pascal-P6 is an extended Pascal. P5 is 1.3, so yes, pascal-p5_1_3.tar.gz.
Ok, thanks!
I got
https://sourceforge.net/projects/pascalp5/files/pascal-p5_1_3.tar.gz/downloa...
There is no mention of macOS in the README.
The README says:
The full instructions for running and setting up the P5 compiler/interpreter have all been incorporated into the document:
doc/the_p5_compiler.docx
Which is a Microsoft Word document, 2007 or later. it is also available in the formats:
doc/the_p5_compiler.pdf Adobe Portable Document Format. doc/the_p5_compiler.html Web page format. doc/the_p5_compiler.doc Word 1997-2003 format.
Please consult one of these documents for full instructions on how to use P5.
But that's not true. The doc/ diretory only contains:
The_Programming_Language_Pascal_1973.pdf basic.docx iso7185rules.html the_p5_compiler.docx
The_Programming_Language_Pascal_1973.pdf is great to have a copy of!
I used libreoffice to convert to pdf:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf basic.docx
2 Beta software warning p5 Basic is beta software at this time (version <1). It should not be considered reliable for production use.
Oh my. Looks like your documentation may be out of date. Is this still beta despite version > 1?
Convert the other docx:
/Applications/LibreOffice.app/Contents/MacOS/soffice -env:UserInstallation=file:///tmp/schneidt.lico --headless --convert-to pdf the_p5_compiler.docx
This one is dated August 29, 2014 and on page 14 it says:
Is P5 a sueable compiler for real applications? I would assert that it is not.
That's no good!
./setpath ./configure make
% ./setpath ./setpath: Permission denied.
You have the windows setpath.bat but have not set the permissions on setpath correctly. % chmod u+x setpath
egg 320% ./configure ./configure: Command not found.
% chmod a+rx configure % ls -l configure -rwxr-xr-x 1 schneidt admin 6469 Jan 5 2018 configure* % ./configure ./configure: Command not found. %
This is really weird.
Please set it up to work on macOS.
Tom
Thomas D. Schneider, Ph.D. Senior Investigator National Institutes of Health National Cancer Institute Center for Cancer Research RNA Biology Laboratory Biological Information Theory Group Frederick, Maryland 21702-1201 schneidt@mail.nih.gov https://alum.mit.edu/www/toms _______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc _______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc
Hi,
Hopefully this information will answer some questions that have appeared on this list.
Q. What is ISO 7185?
A. The standard for the original Pascal language. It appeared in about 1982, and was revised in 1990, which I believe is the current version.
Q. Who follows it?
A. GPC, FPC, and IP Pascal.
Q. How do I find out if my compiler complies with ISO 7185?
A. You can either get ahold of the BSI standards suite, or use Pascal-P5 testing facillities. The BSI test is defunct, BSI (British Standards Institute) no longer provides it. It used to sell for $1000. It bears copyrights. However, there is always that friend of a friend who has it.
Q. What is negative and positive testing?
A. This is my own terminology, but I note that many others also use it. Positive testing is testing for programs that will correctly compile/run on an ISO 7185 system, and negative testing is testing for programs that should be rejected by an ISO 7185 system (also called an "acceptance" and "rejection" test protocol).
Although the difference sounds technical, an implementation can be considered ISO 7185 compatible (specifically by me) if it is positive tested only, meaning that it will accept any valid ISO 7185 program.
Q. Goodness, my compiler (GPC, FPC, whatever) does not pass those tests. What's up with that?
A. The ISO 7185 tests with Pascal-P5 are constantly updated with test for rules in ISO 7185. Thus it is not a surprise that compiler X might fail them. In fact, pretty much by definition compilers will fail the newer tests.
The compilers ============================================
Here is a roundup of currently available (and some not so available).
GPC
GPC is a good, high optimization compiler based on GCC. It passes, or did pass, my positive ISO 7185 tests from several years ago. I have never performed negative testing on it, and assume it would fail.
There are only a few select versions of it that are fully ISO 7185 compliant (and that work).
They include:
32 bit windows/mingw
64 bit Linux.
The Mac OS version used to work, but Mac OSx made changes to depreciate the GCC compiler and thus also killed GPC.There may be ways to fix it, and there have been extensive discussions on that in this list.
There is also a 32 bit GPC on linux, but I have not used or tested that for many years.
Note that I don't do testing on GPC (positive or negative) anymore simply because there is no point. There is no development team there to fix the problems if I were to find them.
GPC disbanded its support group, but I note that they could fix their issues, by, say, recoding for LLVM backends, so who knows?
FPC
The FPC group decided that they wanted ISO 7185 capability as part of their language abilities. To that end, they made good strides and passed the last version of my positive ISO 7185 test. They don't pass the new one, but note that I have added new tests since that time, and further, they are working towards achieving positive compliance again.
FPC does not, as far as I know, do not do negative testing, nor is that their goal.
FPC (from what I have heard) couples to the LLVM toolset, meaning that it will generate good code and be viable into the future.
Pascal-P5
P5 is a "model compiler", meaning that its basic mission is to be an example of how to build a completely ISO 7185 compliant Pascal, in both negative and positive senses. It is also both in itself and the tests it runs, a very complete test of ISO 7185 compliance. I regularly run those tests on Pascal-P5 itself. I occasionally run the positive testing on other compilers that interest me (FPC).
P5 does not generate actual machine code. It is an interpreter only, although it is a very good one. For example it is the first of the Pascal-P series that can self compile (without extensions). At some point in the Pascal-P series, I wish to have it generate code for real machines, but note that the purpose of that work would never be to achieve a high optimization compiler. As good as P5 is for a short demo/model compiler, it is not a good platform at all for a modern, optimizing compiler.
In any case, I tried creating a real code generator for P5, but quit when I realized that it would be useless without some minimal extensions (file handling by name for example). In fact, there has never been an unextended Pascal compiler used to generate code. Even the original CDC 6000 compiler from Zurich had extensions for CDC 6000/Scope.
Thus I realized that adding a code generator to P5 would do work on it that was redundant with Pascal-P6, and so I have left it to the Pascal-P6 project to do that.
Pascal-P6
Pascal-P6 is Pascal-P5 with extensions. Its a rollup of extensions I used in IP Pascal for about the last 20 years, with some new things added, mostly to do with parallel processing. The good news is it is mostly complete. The bad news is it is still very much beta software.
The idea of P6 is to support at least Linux, Windows and Mac OS X. In fact, with the C machine interpreter done some time ago, it could support all three systems now (because the C interpreter only depends on your having working CLIB support). However, it is:
A. Beta software. B. I am more interested in compiled machine code than interpreters.
Pascal-P6, even with code generation, is never going to be a high optimization production compiler, nor is that a design goal. It is designed to be as simple as possible an implementation of its source language, extended pascal, or as I name it, "Pascaline". I already have an implementation for industrial level Pascal, which is IP Pascal.
However, P6 will be a "reasonable" compiler, and it's runtime library is already quite far along.
IP Pascal
This compiler was started in 1987 and was meant to be a paidware compiler. However, not long after that the "compiler apocalypse" occurred, and many or even most commercial users standardized on open source compilers, especially GCC. Many compiler makers went out of business during that time, including Watcom, Oregon, SVS and many others. I continued to use the compiler through about 2003, at which time I organized a set of extended Pascal language constructs known here as "Pascaline", and implemented them in IP Pascal.
I also worked to create Pascal-P5 in that time (approx 2010) and noticed that IP Pascal itself had a lot of trouble passing the ISO 7185 test set I created. This was about the time GPC group announced they were halting their project. I decided to modernize P4 to be fully ISO 7185 compilant, as well as greatly increasing the ISO 7185 test facilities there, with the idea that this would come back around and be a good test for IP Pascal, as well as adding an open source Pascal to the world.
Will IP Pascal ever be open source? Possible. I'm 62, so its equally likely I could move on to a dirt condo. If I am around, IP Pascal has one further task to perform, and that could happen.
Regards,
Scott Franco
samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas program test(output); var b,c: real; begin b := maxint; c := 10.0; b := b+c; writeln(b:40:1); writeln(maxint:38); end. samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ ./test 9223372036854775808.0 9223372036854775807
Longreal gives the correct result:
samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas program test(output); var b,c: longreal; begin b := maxint; c := 10.0; b := b+c; writeln(b:40:1); writeln(maxint:38); end. samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ ./test 9223372036854775817.0 9223372036854775807
--------- Original Message --------- Subject: Errrr what? From: "scott andrew franco" samiam@moorecad.com Date: 8/31/20 1:07 pm To: "gpc@gnu.de" gpc@gnu.de
samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas program test(output); var b,c: real; begin b := maxint; c := 10.0; b := b+c; writeln(b:40:1); writeln(maxint:38); end. samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ ./test 9223372036854775808.0 9223372036854775807
On Mon, Aug 31, 2020 at 01:07:42PM -0700, scott andrew franco wrote:
samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas program test(output); var b,c: real; begin b := maxint; c := 10.0; b := b+c; writeln(b:40:1); writeln(maxint:38); end. samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ ./test 9223372036854775808.0 9223372036854775807
Note that floating point results are approximate and on 64-bit machines real accuracy is lower than integer accuracy.
Waldek,
Sure, 48 bits vs 64 bits. Why didn't it truncate the mantissa on conversion to float, ie, b := maxint? I would have expected something like zeros on the right side.
Thanks,
Scott
--------- Original Message --------- Subject: Floating point From: "Waldek Hebisch" hebisch@math.uni.wroc.pl Date: 8/31/20 7:58 pm To: "gpc@gnu.de" gpc@gnu.de
On Mon, Aug 31, 2020 at 01:07:42PM -0700, scott andrew franco wrote:
samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas program test(output); var b,c: real; begin b := maxint; c := 10.0; b := b+c; writeln(b:40:1); writeln(maxint:38); end. samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ ./test 9223372036854775808.0 9223372036854775807
Note that floating point results are approximate and on 64-bit machines real accuracy is lower than integer accuracy.
-- Waldek Hebisch
_______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc
In any case, yes, I see the test does not work. Its 1735 (from the Pascal-P5 test catalog):
{ PRT test 1735: For trunc(x), the value of trunc(x) is such that if x is positive or zero then 0 < x-trunc(x) < 1; otherwise 1 <x- trunc(x) < 0. It is an error if such a value does not exist. ISO 7185 reference: 6.6.5.3 } program iso7185prt1735; var a: integer; b: real; begin { assign maximum value of integer } b := maxint; { now move it completely out of range in floating point only } b := b+10.0; { now the assignment is invalid } a := trunc(b) end. I'm open to suggestions. ISO 7185 does not have a "maxreal" or similar. I guess b := maxint; b := b*2 would do it. I was trying for something more subtle (which clearly didn't work). Regards, Scott Franco
--------- Original Message --------- Subject: RE: Floating point From: "scott andrew franco" samiam@moorecad.com Date: 8/31/20 8:06 pm To: "Waldek Hebisch" hebisch@math.uni.wroc.pl, "gpc@gnu.de" gpc@gnu.de
Waldek,
Sure, 48 bits vs 64 bits. Why didn't it truncate the mantissa on conversion to float, ie, b := maxint? I would have expected something like zeros on the right side.
Thanks,
Scott
--------- Original Message --------- Subject: Floating point From: "Waldek Hebisch" hebisch@math.uni.wroc.pl Date: 8/31/20 7:58 pm To: "gpc@gnu.de" gpc@gnu.de
On Mon, Aug 31, 2020 at 01:07:42PM -0700, scott andrew franco wrote:
samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ cat test.pas program test(output); var b,c: real; begin b := maxint; c := 10.0; b := b+c; writeln(b:40:1); writeln(maxint:38); end. samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ gpc -o test test.pas samiam@samiam-home-pc:~/projects/pascal/pascal-p5$ ./test 9223372036854775808.0 9223372036854775807
Note that floating point results are approximate and on 64-bit machines real accuracy is lower than integer accuracy.
-- Waldek Hebisch
_______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc _______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc
************************** Pascal-P5 1.4 RELEASE ***************************** You can also find this news at: https://sourceforge.net/p/pascalp5/discussion/news/ WHAT'S NEW IN THE 1.4 RELEASE * ISO 7185 negative and positive tests greatly expanded. * Covers essentially ALL ISO 7185 error cases. * Moved source configuration from SED to CPP (preprocessor). * Now uses separate MPB includes for basic configuration. * Certified for both 32 bit and 64 bit operation in Windows and Linux. * Documentation updates. * Increased available compiler options. * Many bugs fixed. * Source code tracking/debug system now more accurate. * Enhanced regression reporting. * Greatly improved error handling (no more crashes after error). * Compiler/interpreter updated to tighter ISO 7185 standards checking. * Spew checking (fault insertion checking). * Added misspelled symbol and misspelled identifier recovery. * Supressed duplicate errors on same undefined identifier. * Supressed duplicate errors on files not in program header. The 1.4 version of Pascal-P5 is the best tested, most ISO 7185 compliant implementation of the Pascal language available. And at just over 10k lines (total), it's also one of the smallest. It has been extensively checked for operation in three different environments: * Windows 32 bit with DOS shell. * Windows 32 bit with Bash shell. * Linux 64 bit with Bash shell. It's test suite tests for both constructs that comply with the ISO 7185 as well as testing that the compiler rejects constructs that do not comply. It in fact surpasses the old BSI test protocol, which is no longer obtainable in any case. It has also been extensively fault tested by a program that inserts random faults into the source code and tests that the compiler will not crash or halt from simple source errors. The 1.4 update incorporates many elements of Pascal-P6 that apply to the ISO 7185 standard only. Thus it was brought up to date with Pascal-P6. This is expected to be the last major source code improvement for Pascal-P5. Pascal-P5 comes from a long line of Pascal compilers, starting with the first operational compiler for Pascal in 1973 from ETH Zurich by Niklaus Wirth's group. Nearly 50 years old, it progressed through the versions Pascal-P1 to Pascal-P4, and the versions Pascal-P2 and Pascal-P4 were used as the basis for many operational Pascal compilers. Pascal-P5 brings it to full ISO 7185 status, and Pascal-P6 extends the language greatly. Questions: Q1: Does Pascal-P5 generate machine code, or will it ever? A1: No, it is designed to be an ISO 7185 compiler only. There has never been an operational compiler that didn't extend the base language of Pascal, including the original CDC 6000 compiler. Thus I decided to create a new version of Pascal-P, Pascal-P6, that both extended the language and finished aspects of Pascal-P that I thought needed addressing, like debug mode and machine code generation. Q2: Does Pascal-P5 have a use? A2: Besides it's use as a model compiler, Pascal-P5 can be used as a "lint" style utility to verify programs to the ISO 7185 language. For this you would partition your code into ISO 7185 compliant and non-compliant sections, and use the cpp provided "include" facility to allow compilation and checking of just the core ISO 7185 part. Q3: Does Pascal-P5 run on Mac OS X? A3: Pascal-P5 needs a host compiler. GPC used to run on the system, but no longer does. FPC runs on Mac OS X, but does not compile the current version of Pascal-P5. There are mentions on the web of versions of Pascal-P5 that do run under FPC, but have been modified from their ISO 7185 form and are likely downrev (from a previous revision) as well. I understand from the FPC group that most or all of the issues have been corrected in tip (the source you get directly from git repository), so if you are able to compile a working FPC from sources, that may work for you. Q4: What is the advantage of the original Pascal/ISO 7185 language? A4: Original Pascal as defined N. Wirth (with T. Hoare and others) was a type safe or protected language, meaning that the program could not crash itself with accesses beyond the end of an array, or wild pointers, etc. Protected languages experienced a renassance in the 1990s with Java and C#, but Pascal did the same (and arguably better) decades previously. Most people don't realize this because neither the authors of those languages nor the computer press gave proper credit to N. Wirth., and in fact the way pointers are kept type safe in Pascal (a design by T. Hoare) is still better than that of Java and C# (so called "managed pointers"). Futher, many of interpreted languages of today are popular because they are also type safe, even though they are much slower. This is one reason I still think there is a place for a language to replace C/C++, that is as fast and as versatile, but still type safe/protected.
On 04/09/2020 08:49, scott andrew franco wrote:
Q1: Does Pascal-P5 generate machine code, or will it ever?
A1: No, it is designed to be an ISO 7185 compiler only. There has never been an operational compiler that didn't extend the base language of Pascal, including the original CDC 6000 compiler. Thus I decided to create a new version of Pascal-P, Pascal-P6, that both extended the language and finished aspects of Pascal-P that I thought needed addressing, like debug mode and machine code generation.
This does not appear to be the answer to that question.
Jonas
The answer was no, it does not generate machine code.
Scott Franco --------- Original Message --------- Subject: Re: Release 1.4 of Pascal-P5 From: "Jonas Maebe" jonas@freepascal.org Date: 9/4/20 8:41 am To: "gpc@gnu.de" gpc@gnu.de
On 04/09/2020 08:49, scott andrew franco wrote:
Q1: Does Pascal-P5 generate machine code, or will it ever?
A1: No, it is designed to be an ISO 7185 compiler only. There has never been an operational compiler that didn't extend the base language of Pascal, including the original CDC 6000 compiler. Thus I decided to create a new version of Pascal-P, Pascal-P6, that both extended the language and finished aspects of Pascal-P that I thought needed addressing, like debug mode and machine code generation.
This does not appear to be the answer to that question.
Jonas
_______________________________________________ Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc
On Mon, Aug 31, 2020 at 08:06:45PM -0700, scott andrew franco wrote:
Waldek,
Sure, 48 bits vs 64 bits. Why didn't it truncate the mantissa on conversion to float, ie, b := maxint? I would have expected something like zeros on the right side.
On x86_64 gpc uses SSE unit for floating point. So real has 64-bit IEEE format, with 53 significant bits. IEEE says that operations should round result and that is what happens: closest representable number is 2^63, that is maxint + 1.
Concerning testing floating point, standard requires almost nothing. So it boils down to quality of implementation, and I would argue that 64-bit IEEE format + optimizations in gpc give high quality implementation. But IEEE rules (as other floating point rules) may produce results which does not agree withj naive intuition. In some cases optimizations lead to results which are slightly different than literaly performing operations according to IEEE rules -- I consider this normal (otherwise it would be almost impossible to optimize floating point).
Back to testing: in the Pascal spirit you should test if realative error of operations does not exceed assumed maximal error. Similarly for range. Standard does not give you _any_ constraints on range or accuracy. IIUC having single floating point number, (that is 0) is legal (but useless) implementation. I would say that 20 significant bits and 8 exponent bits is probably reasonable lowest limit of accuracy.