Skip to content

Comment on G# – A modern .NET language with Go, Kotlin, and Swift ergonomicsparent

Comments

how do you make a programming language like this from scratch?

Write a parser from your language’s syntax to an AST (Abstract Syntax Tree) which is the representation of the code in memory. Now write a function from the AST to the compiler output format. That can be some executable binary format (see https://en.wikipedia.org/wiki/Comparison_of_executable_file_...) or some other language, like C (a common target) or something made exactly for that like LLVM (used by clang and Rust), Java or C# bytecode if you don’t mind requiring a VM to run the application. I’ve written Java bytecode generators and it’s surprisingly easy! Getting a simple language off the ground is a lot of fun and not a huge challenge.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.