The following source (cut down already)
PROGRAM pprt(input, output);
(* Nils Goesche ngo@cartan.de wrote in comp.programming
0 is defined as the empty set -- denoted {} 1 is defined as the set that contains 0 -- {0} = {{}} 2 is defined as the set containing 0 and 1 -- {0, 1} = {{}, {{}}}
and so on. (Mathematicians will note that to have this ``definition´´ make sense, you'll first have to introduce the notion of an inductive set and the infinity axiom -- but I think this is enough to explain the idea behind the construction).
Now, the programming problem is to produce a nice, pretty printed definition of a natural number n. *)
VAR n : integer;
(* 1----------------1 *)
PROCEDURE prettyprt(n : integer);
BEGIN (* prettyprt *) END; (* prettyprt *)
(* 1----------------1 *)
BEGIN (* pprt *) REPEAT write('Value to display: '); readln(n); IF n >= 0 THEN prettyprt(n); writeln; UNTIL n < 0; END. (* pprt *)
results in the following error from gpc
[1] c:\p\pprt>gpc -v pprtx.p Reading specs from c:/djgpp/lib/gcc-lib/djgpp/2.953/specs gpc version 20020910, based on 2.95.3 20010315/djgpp (release) c:/djgpp/lib/gcc-lib/djgpp/2.953/gpcpp.exe -lang-pascal -v -famtmpfile=c:/djgpp /tmp\ccaaaaaa -fstandard-pascal -D__STANDARD_PASCAL__ -fmixed-comments -undef -D __GNUC__=2 -D__GNUC_MINOR__=95 -D__GPC__=2 -D__GPC_MINOR__=1 -D__GPC_VERSION__=2 .1 -D__GPC_RELEASE__=20020910 -D__BITS_LITTLE_ENDIAN__=1 -D__BYTES_LITTLE_ENDIAN __=1 -D__WORDS_LITTLE_ENDIAN__=1 -D__NEED_NO_ALIGNMENT__=1 -Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS -D__OS_DOS__=1 -D__unix__ -D__i386__ -D__GO32__ -D__DJGPP__=2 -D__MSDOS__ -D__OS_DOS__=1 -D__unix -D__i386 -D__GO32 -D__DJGPP=2 -D__MSDOS -Asy stem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386) -Acpu(i386) -Amachine(i38 6) -Di386 -D__i386 -D__i386__ -D__tune_pentium__ -imacros c:/djgpp/lib/gcc-lib/d jgpp/2.953/djgpp.ver -remap pprtx.p c:/djgpp/tmp\ccSv07U1.i GNU Pascal Compiler PreProcessor version 20020910, based on gcc-2.95.3 20010315/ djgpp (release) (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: /usr/local/include c:/djgpp/i586-pc-msdosdjgpp/include c:/djgpp/lib/gcc-lib/djgpp/2.953/include c:/djgpp/include End of search list. pprtx.p:32: unterminated string or character constant pprtx.p:10: possible real start of unterminated constant
I suspect something in the quoted comment line 10 is driving it up the wall, such as a "'". gpc is being run through an alias that supplies --standard-pascal.
Are you trying to have the lexer do too much at once? Once a comment is started nothing except *) (or maybe } or EOF) should close it.
I took the isolated ' out of the comment, and the error changed. So I think there is enough to annoy it in there.
It compiles through rhide150b though! Also PascalP has no problem.
On Sun, 17 Nov 2002, CBFalconer wrote:
(* Nils Goesche ngo@cartan.de wrote in comp.programming
0 is defined as the empty set -- denoted {} 1 is defined as the set that contains 0 -- {0} = {{}} 2 is defined as the set containing 0 and 1 -- {0, 1} = {{}, {{}}}
and so on. (Mathematicians will note that to have this ``definition�� make sense, you'll first have to introduce the notion of an inductive set and the infinity axiom -- but I think this is enough to explain the idea behind the construction).
It seems your gpc version doesn't like nested comments in cited von Neuman definition... My old (20020510), based on 2.95.2 doesn't complain. Best regards, Adam Naumowicz
====================================================================== Department of Applied Logic fax. +48 (85) 745-7662 Institute of Computer Science tel. +48 (85) 745-7559 (office) University of Bialystok e-mail: adamn@mizar.org Sosnowa 64, 15-887 Bialystok, Poland http://math.uwb.edu.pl/~adamn/ ======================================================================
CBFalconer wrote:
The following source (cut down already)
PROGRAM pprt(input, output);
(* Nils Goesche ngo@cartan.de wrote in comp.programming
0 is defined as the empty set -- denoted {} 1 is defined as the set that contains 0 -- {0} = {{}}
[...]
gpc is being run through an alias that supplies --standard-pascal.
Are you trying to have the lexer do too much at once? Once a comment is started nothing except *) (or maybe } or EOF) should close it.
According to both standards, comments can be closed with either `*)' or `}', regardless whether they were started with `(*' or `{' (see ISO 7185, 6.1.8, the grammar rule and note 1). So the comment ends at the first `}', and the following text is no valid Pascal, of course.
Since we don't consider this behaviour too useful (and apparently you don't, either ;-), GPC's default is to require "matching" comment endings. However, with `--standard-pascal' etc., the standard conformant behaviour is enforced.
You can override it with `--no-mixed-comments'.
Also PascalP has no problem.
Then it's not strictly conformant. ;-)
Frank
CBFalconer wrote:
The following source (cut down already)
PROGRAM pprt(input, output);
(* Nils Goesche ngo@cartan.de wrote in comp.programming
0 is defined as the empty set -- denoted {} 1 is defined as the set that contains 0 -- {0} = {{}} 2 is defined as the set containing 0 and 1 -- {0, 1} = {{}, {{}}}
and so on. (Mathematicians will note that to have this ``definition´´ make sense, you'll first have to introduce the notion of an inductive set and the infinity axiom -- but I think this is enough to explain the idea behind the construction).
Now, the programming problem is to produce a nice, pretty printed definition of a natural number n. *)
VAR n : integer;
(* 1----------------1 *)
PROCEDURE prettyprt(n : integer);
BEGIN (* prettyprt *) END; (* prettyprt *)
(* 1----------------1 *)
BEGIN (* pprt *) REPEAT write('Value to display: '); readln(n); IF n >= 0 THEN prettyprt(n); writeln; UNTIL n < 0; END. (* pprt *)
results in the following error from gpc
[1] c:\p\pprt>gpc -v pprtx.p Reading specs from c:/djgpp/lib/gcc-lib/djgpp/2.953/specs gpc version 20020910, based on 2.95.3 20010315/djgpp (release) c:/djgpp/lib/gcc-lib/djgpp/2.953/gpcpp.exe -lang-pascal -v -famtmpfile=c:/djgpp /tmp\ccaaaaaa -fstandard-pascal -D__STANDARD_PASCAL__ -fmixed-comments -undef -D __GNUC__=2 -D__GNUC_MINOR__=95 -D__GPC__=2 -D__GPC_MINOR__=1 -D__GPC_VERSION__=2 .1 -D__GPC_RELEASE__=20020910 -D__BITS_LITTLE_ENDIAN__=1 -D__BYTES_LITTLE_ENDIAN __=1 -D__WORDS_LITTLE_ENDIAN__=1 -D__NEED_NO_ALIGNMENT__=1 -Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS -D__OS_DOS__=1 -D__unix__ -D__i386__ -D__GO32__ -D__DJGPP__=2 -D__MSDOS__ -D__OS_DOS__=1 -D__unix -D__i386 -D__GO32 -D__DJGPP=2 -D__MSDOS -Asy stem(unix) -Asystem(msdos) -Acpu(i386) -Amachine(i386) -Acpu(i386) -Amachine(i38 6) -Di386 -D__i386 -D__i386__ -D__tune_pentium__ -imacros c:/djgpp/lib/gcc-lib/d jgpp/2.953/djgpp.ver -remap pprtx.p c:/djgpp/tmp\ccSv07U1.i GNU Pascal Compiler PreProcessor version 20020910, based on gcc-2.95.3 20010315/ djgpp (release) (80386, BSD syntax) #include "..." search starts here: #include <...> search starts here: /usr/local/include c:/djgpp/i586-pc-msdosdjgpp/include c:/djgpp/lib/gcc-lib/djgpp/2.953/include c:/djgpp/include End of search list. pprtx.p:32: unterminated string or character constant pprtx.p:10: possible real start of unterminated constant
I suspect something in the quoted comment line 10 is driving it up the wall, such as a "'". gpc is being run through an alias that supplies --standard-pascal.
Are you trying to have the lexer do too much at once? Once a comment is started nothing except *) (or maybe } or EOF) should close it.
I took the isolated ' out of the comment, and the error changed. So I think there is enough to annoy it in there.
It compiles through rhide150b though! Also PascalP has no problem.
I think I found it - mixed comments!! I thought they defaulted to off. Did this get changed? If so, it meets standards, so I can't complain.
Woops, resending, as it appears I sent this to myself!.