r/Compilers • • 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

3 comments sorted by

View all comments

Show parent comment

1

u/Gordon-NZ Oct 17 '26

Sounds like I should simply write my own i/o routines. Pascal* had some different routines: Read() for example.

Thanks all.