High level languages that are fully recusively defined

Are there any programing languges that can be defined in simple
primtives like + - logical (load) (store) shifting. that is extendable.
Forth comes to mind, but still too abstract as primitives.
I am coding floating point routines for the 4kb BIOS I have,
and wishing I could write all in a high level languge.
How ever I have to use ADC SBC and other Computer instructions
that use the carry and other flags as well as offsets from the stack pointer. To my knowlage there are no programimg laguages that let me express such featues and having just
half int and int data sizes. Any thoughts about expaning bootrapable
langauge like this.

  primitives
add(a b)
ADD a to b
return a

mult (x y)
i = #word_size
b = x
a = 0
loop i --
if odd b then
add y to a  
if carry_flag then shift a:b right with carry end
else shift a:b right with zero
end
return a:b 

Hm – what about the other way round, a higher programming language with low-level register support? PL/M comes to mind. There seems to have been a version for the 6502 as well (on the KIM-1).
Compare, A PL/M-6502 Cross-compiler for the KIM-1 - Gary P. Kennedy - Google Books

I get a annoying version of google play in german from that link,
but no book.
What I am looking for is a more abract low level support.
A meta-compiler or macro processor just process strings of
of text unable to handle the concept of a stack or heap,
If they could then I could define macros for my needs.

ADD#n(a,b) {clear carry, repeat#n ld a+# adc b+#,st a+# end}

A second pass then could translate into processor specific code.
and adding stack or other pointers to data as needed.

Bootstrapping from basic assembler macros looks more like it. However, few of the classic assemblers or preprocessors implement actual stack frames / activation records, which is what you need for recursive reentry. I can see you point.

Regarding PL/M for the 6502: There are one or two ports of CP/M to the 6502 platform. What did they use for tooling? Probably some kind of PL/M tool chain, if they didn’t a full rewrite…

I think Lisp would be a workable answer here, but there would be a learning curve, and right now I know next to nothing, so all I can do is express confidence!

This isn’t the project you want, but it might be a distant relation:

Perhaps see also David Wheeler’s pages, which mention COMFY-6502, a Lisp-ish ‘medium level language’

Naturally my searches are finding 6502 related things, but I’m sure the ideas are not restricted to 6502.

The thing about Lisp is that you build your own domain-specific language for the problem at hand.

Lots of good ideas here. Logo might work best for me rather than Lisp.
The formal defines for list are too confusing, and recusive. Take tail recusion, the newer Lisps turn that into a simple loop, why not be clear
and write the loop in the fiirst place. Lisp is really a string pocessing
language if look at what atoms are.
My current goal is Algol style language, no { } , ; 's and left right parsing with ()'s being done first. Data types real , int or byte. A C subset is
defined to make porting simple for what little system software I have.
Bytes are 1/2 the word size of the cpu. At the moment a 24 bit machine.
This month will be hardware mods.Ben.

I think this might also be interesting; it’s been open in my browser for a while, but I don’t remember where I found it. Possibly this forum!

It is a self-hosted LISPish compiler that can compile itself to machine code, plus a bootstrap in C (you check out a C implementation from a Git tag, as well as a later version of the all-LISP implementation, and use the C implementation to compile the latter to achieve self-hosting).

The implemented targets are x86-32 and LLVM, but I’m betting other 32-bit machines are within reach. Smaller machines are probably more work!

2 Likes

Very interesting, and at one time very promising. I hope this resurrection will get where it’s going - the first iteration rather stalled out and was abandoned. (Possibly funding related as much as anything - not a judgement on the project or the people.) I’ve been following it, very passively.

Maru was developed as part of Alan Kay’s Fundamentals of New Computing project, by the Viewpoints Research Institute. The goal of the project was to implement an entirely new, self-hosting computing system, with GUI, in 20.000 lines of code.

From 2012, the final report (pdf, 52 pages).

1 Like

Ian Piumarta worked on several similar projects in order to help make concrete to himself the ideas he expressed in this COLAs whitepaper. These projects included several JITs for Squeak Smalltalk, a tiny Lisp to celebrate that language’s 50th anniversary and Maru among others. He also explored other directions, such as explaining the semantics of all object-oriented languages in terms of operations on associative memories.

2 Likes