New languages are always cool! But I thought Swift had been ported to other platforms already? I know there are server-side Swift frameworks that run on Linux.
Echoing @logikil, show us some syntax! If you’re drumming up interest, people are going to want to see what the language looks like. Even just a high level list of Swift features you do/don’t plan to support.
I advocate using tools to generate any non-simple parser, and Swift is definitely non-simple. I’ve found PEG parser generators the best. I’m not aware of any that emit Swift code, though.
Swift has indeed been ported to other platforms, but the UX is pretty challenging. Plus, the standard library isn’t available everywhere extensively.
Syntax will just be plain Swift, but a subset with the more esoteric features missing. I definitely want enums with associated values, for instance. But generic protocols might be a bridge too far for a small team to get done.
I started using tooling for lexer generation, but in the end found it was just simpler to write by hand. As for the parser, i’m aiming to use recursive descent at this stage.
Thanks for your interest really appreciate it, given how little we’ve got done so far :)
Hey thanks for the interest. So far we have built the lexer and have had lots of conversations about the parser, and there’s a PoC for the output->C stage. Hopefully we can make something useful of this.
This is really cool! I asked in an issue on GitHub, but do you have even nascent sketches of what yous think the syntax will look like?
Thanks! I responded :) Basically it’ll be a subset of Swift.
hahaha I saw that, and those were great answers! I would definitely be interested in what subset of Swift you’ll be picking, as that would be really interesting as well. I’m also happy to help if you need it, I’ve written a few systems that compile to human-readable C, Java, & Golang.
Thanks! I hoped i had the right idea. As for ‘what subset’ - that’s a bit of an open question at this stage, sorry i can’t clarify yet. I’d be thrilled to have you involved, I’ll send a DM with details :)
this made me realize i don’t know where (in anywhere) llvm isn’t available
Yeah LLVM isn’t really available in a lot of embedded toolchains, for instance I’ve done some hobby work on the ESP8266 which uses a GCC-based toolchain. So that ruled out using eg rust at the time (i believe it might have a gcc backend now?) which was a pity. So one of the things I’d like to play with is using Sonic to generate C that is trivially easy to use in whatever weirdo embedded toolchain comes with all the embedded dev boards I often impulse-buy! Thanks for your interest :)
FYI: There is a WIP back end for ESP32 that is in the process of being upstreamed to LLVM. The number of ISAs that don’t have an LLVM back end and are actively being sold is reducing over time. The back end isn’t all you need for a compiler (you also need to know a bit about the calling conventions and object file formats and so on) but a working LLVM back end is pretty much table stakes for embedded silicon these days. The Synopsis LISA toolchain will synthesise the LLVM back end for you at the same time as it synthesises the instruction decoder, so when you move more into the accelerator domain you’ll sometimes see an LLVM back end and not a C compiler these days.