_______ __ _______
| | |.---.-..----.| |--..-----..----. | | |.-----..--.--.--..-----.
| || _ || __|| < | -__|| _| | || -__|| | | ||__ --|
|___|___||___._||____||__|__||_____||__| |__|____||_____||________||_____|
on Gopher (inofficial)
URI Visit Hacker News on the Web
COMMENT PAGE FOR:
URI Show HN: GDSL â 800 line kernel: Lisp subset in 500, C subset in 1300
QuadmasterXLII wrote 45 min ago:
where does it generate assembly assembly / llvm ir / machine code? I
poked around and didnât immediately spot this, or even which it
targets.
FirTheMouse wrote 39 min ago:
That's the MIX. As mentioned in the README I haven't setup a system
for these yet, just made the scaffolding, as a lot of the work in
this space is actually around just the MIX layer.
I'll probably be posting about more backend systems once I get
started on making them, this project has only been in the works for 5
weeks so far. Though I would invite anyone interested to contribute a
MIX module, that's where I have the least expertise.
QuadmasterXLII wrote 20 min ago:
Right, but like which one does it do in the demo?
FirTheMouse wrote 18 min ago:
The demos run as interpreted trees through the x stage, no code
emission yet, just direct execution of the AST. That's why
they're demos rather than compilers. The scaffolding for native
emission is there but empty.
ptspts wrote 1 hour 27 min ago:
GDSL is written in C++ with use of STL, templates and lambdas, so it's
2600 lines of such C++ source code. There is no self-hosting: neither
the LISP compiler nor the C compiler can compile itself. No operating
system is implemented, the word kernel in the title means something
else.
FYI Here is a 700-line subset-of-C compiler which can compile itself:
[1] . FYI The linker and the libc are not included.
URI [1]: https://github.com/valdanylchuk/xcc700
FirTheMouse wrote 1 hour 18 min ago:
Kernel as used in the title means shared processing core, not
necessarily an OS kernel, which probably deserves clarification. As
for Lisp and C, those are meant to be subset demonstrations not yet
full compilers, thus the phrasing. The compiler you linked is also a
subset of C with only what's needed for a minimal compiler.
Iâve been working towards making it self hosting eventually, which
is why thereâs the start of code for generics in GDSL-C, though
thatâs a significant project which will take significant time. Add
to that, a lot of people would prefer to write handlers in C++ rather
than learn a new language. So it may stay as a C++ project for a
while.
That being said, I was also hesitant to post this until I had it self
hosting, but I decided that being able to implement even the
demonstrated subsets was interesting enough to be worth sharing. This
is a project in progress, and I hope to expand it massively in the
months to come.
xendo wrote 3 hours 29 min ago:
I thought you needed 100k lines of code for a C compiler.
URI [1]: https://www.anthropic.com/engineering/building-c-compiler
balamatom wrote 2 hours 53 min ago:
Because so did the "smartest" AI apparently?
WalterGR wrote 3 hours 33 min ago:
GitHub link:
URI [1]: https://github.com/FirTheMouse/GDSL
akkartik wrote 4 hours 7 min ago:
Looks interesting. The next step may be to show some little fun
examples built with it.
Here's my similar project from a few years ago, in case you want to
compare notes: [1]
URI [1]: https://github.com/akkartik/mu
URI [2]: https://akkartik.name/akkartik-convivial-20200607.pdf
FirTheMouse wrote 3 hours 12 min ago:
I would love to compare notes, reading through Mu has given me a lot
to think about that I may be writing about soon.
I see in Mu a mirror of my own aspirations, GDSL is something I
intend to take down to the metal once I have access to a computer
where I can reach deeper than my Mac allows. Though the path from
here to an OS is by no means a straight one.
Mu is what I would call a MIX layer, the real substance of a process
which turns one line of code into the next. Arguably, a MIX is the
core of what makes a program a program, and the work of Mu, like Lisp
and others, is to elevate it high enough that it becomes the whole
interface.
For a deeply curious mind the MIX is the only thread they wish to
pull. Because the comprehension of things at their most fundamental
level is fuel enough. Unfortunately, the majority of people are not
nearly so curious, thus the dominance of languages like Python.
So what makes Python so much more appealing than direct control? Pure
TAST. Sugar for the hungry, and grammar that lets you say everything
while knowing nothing. Somewhere, between the sugar and the substance
lives the real heart of what makes a tool, and thatâs what Iâve
been picking at from both angles.
I would be curious to see how these could be unified, a Python TAST,
Rust or Haskell DRE (for type systems and borrow checking) and a Mu
MIX underneath. Let the user be lured in by the promise of ease, look
under the hood to see the entire compiler fitting in just under ten
thousand lines, and burrow their way down to the MIX and fundamental
understanding.
DIR <- back to front page