3 ms·
Yeah, it's kind of a cheat. A real language built in assembler would be headaches and I bet a HLL prototype would be hidden somewhere. HLA might be doable, thou
by nickpsecurity 11y ago
Yeah, it's kind of a cheat. A real language built in assembler would be headaches and I bet a HLL prototype would be hidden somewhere. HLA might be doable, though, especially if macro's are used diligently for pre-optimization work.
Competition has gone down from the 70's and 80's, though. I remember reading a Scheme paper that builds a software interpreter then implements the thing in hardware too. There were also people doing HLL-to-microcode compilers to cheat extra performance out of their chips. These days most projects stop at assembler. I'd love to see people whip out their FPGA's and start trying to outdo 70's-80's era innovation in hardware/software designs maybe for modern languages.
One of my concepts collecting dust is the Secure Python Target that merges a capability machine, LISP-like hardware at core for native bytecodes, and compiler from Python to that language. Result could be quite productive, reliable, and secure. Another was a Secure Haskell (or ML/Ocaml) Target. I don't know that kind of stuff as well, though. Python has enough documentation, community, and simplicity (to a degree) that academics could port some of its core to hardware.
- Turing_Machine 11y ago"A real language built in assembler would be headaches" Depending on what you consider a "real language", it's not that bad. I did a Forth in 80x86 assembler years ago, and it was reasonably easy and fun. (I did use the BIOS routines for keyboard/screen I/O...they were one character at a time, IIRC).
- nickpsecurity 11y agoIt does depend on the definition. I'd disqualify Forth as a real language, too. I've always considered it a cross-platform, macro assembler for an abstract, machine design. Like P-code was but more flexible. It's definitely interesting and useful but doesn't feel like a 3GL or even a full LISP. I'd see it as a bootstrap (firmware) or compilation target (eg BootSafe) of a high-level language. Cool that you assembled one, though. (pun intended)
- claystu 11y agoForth has an ANSI standard as a programming language. What more do you need? What features does a language require to make it a 3GL?
- nickpsecurity 11y agoHmm. I was introduced to the term 3GL to mean languages such as ALGOL, PL/1, Fortran, Pascal, C, and so on. Substantially more structured or English-like than assembler. Most definitions say they take care of details unnecessary to writing the programming logic. So, I just looked up the wikipedia article to find the same languages but also that anything above assembler is technically a 3GL. Even HLA is a 3GL by that standard. So, Forth is... at the lowest rung... a 3GL. By that standard, so are macro-assemblers with control flow and typing constructs. Personally, I think that definition is crap and we should reserve 3GL for languages that significantly raised abstraction like those I cited. This is just a matter of opinion, though. Each will see it a different way and there's no right answer. That's what I've learned researching after your comment.
- deleted 11y ago[deleted]
- vidarh 11y agoIt's not that hard to write a "real language" compiler in assembler, lots of people have done so. Amiga-E is a good example for which source code is available. A simple, Wirth-type compiler is very straight-forward to write for most simple ALGOL-family languages. By Wirth-type compiler, I mean recursive descent parser with direct code generation (no AST). Single pass if the language allows it. You need a handful of utility functions for lexical analysis/tokenization, symbol table management, and for outputting code, and then most of the rest is calling subroutines and simple control flow. In fact, some parts, like code generation, can be made very simple in assembler, because you can directly inline code fragments and in effect use them as "templates".
- nickpsecurity 11y agoI'll be darned: your example [1] is indeed a real langauge written in M68K assembly. Also one I'd never heard of so thanks. Old guard's tenacity to get stuff done with constrained hardware and software continues to impress me. Regarding compiler, yeah I was thinking of the complexity of one with AST and optimizations because who would use it without that? That would be an impressive compiler in assembler. Amiga-E is impressive enough, for now, while also proving the concept. Good points as well on how an assembler style could easily use templates and such during code gen phase. I think the analysis and transform phases might be the hardest in an optimizing compiler. Just a guess, though. [1] https://en.wikipedia.org/wiki/Amiga_E https://en.wikipedia.org/wiki/Amiga_E