3 ms·
Terse: A language with hi-level look-and-feel, low-level control (1995) [pdf]
- eterps 3y agoI remember reading this in Dr. Dobb's Journal back in the day when I was still using Assembly language.
- CoastalCoder 3y agoDr. Dobb's Journal was a goldmine. I'm bummed that I discovered it so close to the end of its publication.
- sph 3y agoCame across this while looking for simple languages close to the CPU, yet architecture independent? Sadly, seems like this one might be i386 specific. So, apart from Forth, any suggestion?
- eterps 3y ago- simple language - close to the CPU - architecture independent These 3 aspects are insanely hard to combine effectively. Also is Forth 'close to the CPU'? It definitely is low-level.
- alexisread 3y agoYes, its used to bring up new hardware as its easy to write drivers for (See Open Firmware). If you look at https://github.com/dan4thewin/FreeForth2/blob/master/ff.asm https://github.com/dan4thewin/FreeForth2/blob/master/ff.asm You can see that the x86 registers are used to avoid SWAP instructions via register renaming. That's a sufficiently low level technique to qualify. The thing with Forth for me, is a lack of typing - you need to keep a model of the stack in your head at all times. It should be possible to build that in to a Forth compiler but I've yet to finish a prototype.
- sph 3y agoI don't think that's insanely hard. If you squint hard enough, WASM has those 3 things as a goal, and it is conceptually much easier than developing a regular, general purpose language, say Rust. If you want to focus on performance as well (as WASM does), well, then it becomes really challenging to find a middle ground that works on IA64 and a 6502 chip. So I guess what I am looking for is WASM with less focus on performance and more on portability. Forth might be half a layer above the CPU, but is insanely portable and/or simple to implement from scratch, which is why I mentioned it.
- 5- 3y agothere has recently been a revival of interest in simple c (or c-like) compilers, e.g. https://c9x.me/compile/ https://c9x.me/compile/ (c frontend: https://github.com/michaelforney/cproc https://github.com/michaelforney/cproc) https://github.com/sysprog21/shecc https://github.com/sysprog21/shecc (this fundamentally targets risc-like architectures, but is very clearly written). perhaps eventually a simple well-defined semantics will emerge (i think projects like the above already support more of a regehr-style c rather than iso).
- cylinder714 3y agoNils M. Holm's t3x.org is filled with the most wonderful toys. An example: "SubC is a fast and simple public domain compiler for a clean subset of the C programming language. It can compile itself and passes gcc -Wall -pedantic. Its internals are described in detail in the book Practical Compiler Construction. Note that SubC is a teaching vehicle rather than a production compiler." https://t3x.org/subc/index.html https://t3x.org/subc/index.html And when I say toys, I don't mean mean plastic, trivial items. I mean, I want to buy all of his books, download all of his tools, and collect the whole set, like Legos or other toys never did for me when I was a child.
- speps 3y agoI always thought the ideas from the Mu project were interesting, not sure about its current status as I haven't seen Mu or Akkartik on HN for a while. https://github.com/akkartik/mu https://github.com/akkartik/mu
- akkartik 3y agoI'm around :) Mu is currently on the backburner in favor of my Freewheeling Apps built on LÖVE (https://akkartik.name/freewheeling https://akkartik.name/freewheeling; https://news.ycombinator.com/item?id=36113115 https://news.ycombinator.com/item?id=36113115), particularly Lua Carousel (https://akkartik.itch.io/carousel https://akkartik.itch.io/carousel; https://news.ycombinator.com/item?id=38397715 https://news.ycombinator.com/item?id=38397715). But I'm still open to jamming on Mu with somebody who knows more about OS development. Things like programming the PIC (https://en.wikipedia.org/wiki/Programmable_interrupt_controller https://en.wikipedia.org/wiki/Programmable_interrupt_control...) or testing against real hardware. For example, I'm kinda at an impasse with https://github.com/akkartik/mu/issues/52 https://github.com/akkartik/mu/issues/52 and would really appreciate some advice from an expert.
- sph 3y agoHi akkartik, I often come across your project as I think I'm on the same research path as yours, just trying from a slightly different approach. I am also interested in the bare metal/OSdev world for building a new language, as if you do it early you can avoid getting tainted with the semantics of the host OS you are working on (if you develop a language/OS combo on Linux, it'll probably end up looking very UNIXy) I haven't done OSdev in 20+ years (https://github.com/1player/klesh https://github.com/1player/klesh), but I hope I can set aside some time to dive into mu seriously and maybe pick your brain a bit :) keep up the good work!
- trealira 3y agoC-- is like a lower-level, more primitive variant of C designed for code generation, hence its name. There aren't separate pointer types; everything is just bitsN, where N is the number of bits in the integer or pointer. Tail recursion is explicitly requested by writing "jump fn(args)". There's a computed goto, so you can build your own jumptables like this: section "data" { align 4; jump_tab: bits32[] { L1, L2, L3 }; } f (bits32 x) { goto bits32[jump_tab + 4*x] targets L1, L2, L3; L1: return (1); L2: return (2); L3: return (3); } This is a description of the language. I copied the above code from here. https://www.cs.tufts.edu/~nr/c--/extern/man2.pdf https://www.cs.tufts.edu/~nr/c--/extern/man2.pdf
- ksherlock 3y agoYou could write llvm assembly. It's somewhat architecture dependent in that registers have sizes and ABIs, etc.
- fasterik 3y agoWhat about C89 or a similar subset of modern C?
- cylinder714 3y agoSee Nils M. Holm's SubC compiler above.
- blacksqr 3y agoCool.
- anta40 3y agoKinda reminded me to... Randall Hyde's HLA (High Level Assembly): https://www.plantation-productions.com/Webster/HighLevelAsm/index.html https://www.plantation-productions.com/Webster/HighLevelAsm/... Looks like it isn't under active development anymore.
- Asraelite 3y agoI've been working with assembly for a custom extremely simple virtual architecture I built (like the redstone computers in Minecraft, but for a different game) and I feel like the perfect language for it would be somewhere between assembly and C. Sometimes, I would like the ability to declare variables with automatic register assignment and stack allocation if necessary, but at other times I would like to explicitly choose their assigned register or act on registers directly. HLA seems pretty close to what I want.
- phtrivier 3y agoAs an "in memoriam": is that similar in principles to things like PL/360 [1] ? [1] https://en.wikipedia.org/wiki/PL360 https://en.wikipedia.org/wiki/PL360