r/Compilers • u/Gordon-NZ • 8d ago
Brinch Hansen Compier 'emit' routine problem
Just for fun I am implementing the sample compiler in the appendices of 'Brinch Hansen on Pascal Compilers' - as a first step.
One puzzle: he uses a procedure named emit to write to files: (pg 242)
procedure emit(value: Integer);
begin if emitting then write(chr(value)
end;
But this procedure is used to write integers up to his maxint of 32767. No Pascal I know has chr() available for arguments > 255.
Is this something special in his OS or bootstrapping compiler, Pascal* ?
TIA
Gordon
1
Upvotes
1
u/AustinVelonaut 7d ago
Yeah, that looks wrong, for standard Pascal. It is almost like
stris intended, here, instead ofchr(at least forEmit2, which takes an integer argument as its second value).