Sujet : Re: Release my K&R C compiler along OS and utilities
De : anthk (at) *nospam* openbsd.home (anthk)
Groupes : comp.lang.cDate : 21. May 2025, 06:02:35
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <slrn102pdko.2hm3.anthk@openbsd.home.localhost>
References : 1 2 3
User-Agent : slrn/1.0.3 (OpenBSD)
On 2025-03-20, Oscar Toledo G <
biyubi@gmail.com> wrote:
On 19 Mar 2025 at 6:22:06 CST, "anthk" <anthk@openbsd.home> wrote:
>
On 2025-03-16, Oscar Toledo G <biyubi@gmail.com> wrote:
Hi all.
I've released recently the source code to my almost full K&R C compiler (minus
extern and static) made in 1993-1996.
It was developed based on Small-C and expanded to K&R per the book.
The target of this C compiler is a transputer chip. The C compiler runs under
my own operating system, and you'll find along text editor, assembler,
assorted utilities, a 3D modeler, and a ported Ray Tracer program.
For this to work, I've made a transputer emulator that can be compiled in
recent macOS (test with Macbook Air M1)
The full source code is available at https://github.com/nanochess/transputer
Also three articles about the development are linked there.
Enjoy it!
Regards,
Thanks/Gracias. Altough from you I would expect using something like Minix 3,
or OpenBSD :D.
>
I'm more mainstream these days because I keep distros of IntyBASIC, CVBasic,
and CoolCV for Windows, macOS and Linux.
>
I use a Macbook Air for development, and VirtualBox for running both Windows
and Fedora, so I don't need to use another computer.
>
Regards,
Did you have a look on EForth+Subleq/Muxleq?
Subleq it's a tiny VM/OISC, albeit slow. Muxleq speed it ups a lot
by multiplexing instructions. Eforth runs under it.
https://howerj.github.io/subleq.htmhttps://github.com/howerj/muxleqTHe repo has both subleq and muxleq.
If you want a recent muxleq.dec, email me;
I will submit a ready to run subleq (DEC)
image.
If any, edit muxleq.fth, set to 1 the opt.*
variables related to floats, a better SEE
and loops (do...loop it's a Forth standard).
My settings. Sorry for not posting a diff:
tant opt.multi ( Add in large "pause" primitive )
1 constant opt.editor ( Add in Text Editor )
1 constant opt.info ( Add info printing function )
0 constant opt.generate-c ( Generate C code )
1 constant opt.better-see ( Replace 'see' with better version )
1 constant opt.control ( Add in more control structures )
0 constant opt.allocate ( Add in "allocate"/"free" )
1 constant opt.float ( Add in floating point code )
0 constant opt.glossary ( Add in "glossary" word )
1 constant opt.optimize ( Enable extra optimization )
1 constant opt.divmod ( Use "opDivMod" primitive )
0 constant opt.self ( self-interpreter [NOT WORKING] )
Then:
./muxleq ./muxleq.dec < ./muxleq.fth > ./new.dec
Run:
./muxlec ./new.dec
The interpreter uses a soft float approach. Thus, you
can use -O3 -ffast-math without troubles, I guess.
On guides, "Starting Forth" (Web ANS version) and
Thinking Forth will be more than enough.
There's Sectorforth, but it's really limited. Contrary
to SectorLisp from Jart, it doesn't have
a integer number set save for numbers declared as
forth words such as powers of 2 and numbers maybe from
0 to 16.
If you want to try, you can set a proper SectorForth
by properly bootstrapping the integer part.
https://github.com/cesarblum/sectorforthEnjoy.