boginka's corner

Creating a new programming language

September 18, 2024

I'm doing some research into how to create a programming language. The first step I'll need to do is decide the criteria I have for my language, and of course a name!

Thoughts

I will be using C to write my language. I didn't realize that languages were written with other languages, which I know is silly but at the same time I figured they were written in the highest Assembly. It makes it feel more accessible to do being able to code in a human readable language. C was first written in Assembly but then later it was written with the C version that was written in Assembly. Python is written in C as well. I think C will be more challenging but more rewarding to write a language in as most advantages of C tend to be.

Based on my own preference of working with different languages, I will choose to create a compiled language as opposed to an interpretted language since I dislike how Javascript/Python do not catch errors on compilation. I learned today that interpretted language rely on an interpretter in order to read line by line to execute code. Meanwhile, a compiler is able to compile the code before execution to determine errors such as type mismatches. Also, I think having to ensure that the interpretter is correctly versioned for the language is annoying, along with having to trade off the language being compact to have an interpretter.

Next, I'll need to create a lexer (tokenizer) to take the language and split up the human readable code into a format that can be arranged in a way a computer can read. Then, I'll need to create a parser to take the tokens and turn it into an Abstract Syntax Tree (AST). This provides the compiler what it needs to understand the structure of the code. I will not be writing my own compiler (I think that would a task above my skill level and may turn this project into overwhelming), however I hope to in the future depending on how much I enjoy this project.