r/Compilers • u/Gordon-NZ • Oct 17 '26
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
View all comments
1
u/AustinVelonaut Oct 17 '26
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).