Pascal complier for TeX (was: Re: locations of code that touches dvi)

Shreevatsa R shreevatsa.public at gmail.com
Wed Jul 17 06:38:04 CEST 2019


On Tue, 16 Jul 2019 at 18:32, Thomas Schneider via texhax <texhax at tug.org>
wrote:

> >
> https://github.com/TeX-Live/texlive-source/blob/trunk/texk/web2c/tex.web#L11308]https://github.com/TeX-Live/texlive-source
>
> So that's the source of TeX!  Cool.  But it is a Pascal program - a
> language I use a lot for understanding the underlying theory of
> biology.  I have always wondered where the Pascal compiler is for TeX
> and whether I could use it for my programs.  The current status of
> Pascal is miserable.  I use a translator called p2c - which works but
> which happily translates anything to C and allows compilation of bad
> code which is then really hard to debug.  The Free Pascal Compiler
> doesn't have the original Pascal features and so I can't use it (yet),
> but at least it detects bad code.  Finally, the Gnu Pascal compiler is
> no longer functional on macOS with little chance of being fixed.
> Apparently it works on Linux.
>
> So if there is a compiler I could use that is the basis of TeX, that
> could be a more stable platform.
>
> Where is the TeX Pascal complier?  Is it being robustly maintained?
>

There is no such thing as "the TeX Pascal compiler". When originally
written, TeX was designed to work with a variety of Pascal compilers on a
variety of systems, by making small "system-dependent" changes in "change
files" and keeping the original tex.web unmodified. (Though of course it
was written on a particular system with a particular Pascal compiler; what
Knuth calls "Pascal-H" in a few places in the TeX program.)

Since then, most of the world compiles TeX via conversion to C with web2c.
If you really want to compile with a somewhat recent Pascal compiler, you
have a few options:

- Wolf­gang Hel­big made a set of changes to allow it to be compiled with
GNU Pascal; you can see it on CTAN as the package TeX-GPC:
https://ctan.org/pkg/tex-gpc

-  With GNU Pascal itself becoming somewhat hard to install; he again made
a set of changes to allow it to be compiled with Free Pascal; you can see
it on CTAN as the package TeX-FPC: https://ctan.org/pkg/tex-fpc

- Another very recent option is Jim Fowler's Pascal-to-WebAssembly
compiler, about which he wrote an article in the most recent TUGboat issue.
It allows TeX to run in the browser (locally, i.e. without relying on a
cloud service); you can find the source code at
https://github.com/kisonecat/web2js and you can find a demo at
https://people.math.osu.edu/fowler.291/latex/ or http://tikzjax.com/

Obviously none of these would have been well-tested as the binaries in
major distributions like TeX Live or MikTeX, but I've tested basic
functionality on a small test file with TeX-FPC and web2js and both seem to
work.

Hope this helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20190716/4ac779de/attachment.html>


More information about the texhax mailing list