I made a programming language without any knowledge.

Hello folks! I decided to make a minimal programming language… without any knowledge…

Starting

For this challenge, I chosed C++ because its fast. I would chose rust but i will rewrite with rust later.

And i started to searching about m…


This content originally appeared on DEV Community and was authored by aiocat

Hello folks! I decided to make a minimal programming language... without any knowledge...

Starting

For this challenge, I chosed C++ because its fast. I would chose rust but i will rewrite with rust later.

And i started to searching about making a programming language, and i got some basics about lexers, compilers etc... and I started with reverse polish notation and stack based language. Because they are easy to implement.

Writing a Lexer

Lexer is the simplest part of writing a language, just tokenizing the keywords.

Lexer

I didn't use any lexer generator (like lex) because its better to make it from zero for me. But the worst part of it, I DON'T KNOW C++. And thats why it was a bit torture to me. I still think the lexer i wrote sucks because i made it without any C++ knowledge. But, atleast it works :D

50 100 + put

=> (pseudo)

[
    {token: NUMBER, value: "50"},
    {token: NUMBER, value: "100"},
    {token: ADD, value: ""},
    {token: PUT, value: ""}
]

Compiler? Transpiler?

After writing a lexer, i need to make a compiler/transpiler for my project. (i skipped AST since it doesn't need.) I checked LLVM but its really deep project to dive in so i tried with assembly. And another problem, i don't know assembly too! and i decided to make a C++ transpiler for my language.

It transpiles the code into C++ and runs g++ to compile the C++ source.

Trying the Language

I wanted to test the limits of the language, So i made a brainfuck compiler in my language. I think its best project to test your language too.

Features

After some days, i added tons of things to my language. It was really fun!

Features

Documentation

And the most boring thing in programming scenario... Writing a documentation! Well, i think nobody likes that but everyone needs that too. So i wrote a simple language reference for my programming language.

Finishing

So, that was my adventure about creating a minimal programming language. If you liked the project, you can star on GitHub page!


This content originally appeared on DEV Community and was authored by aiocat


Print Share Comment Cite Upload Translate Updates
APA

aiocat | Sciencx (2022-02-16T19:51:07+00:00) I made a programming language without any knowledge.. Retrieved from https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/

MLA
" » I made a programming language without any knowledge.." aiocat | Sciencx - Wednesday February 16, 2022, https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/
HARVARD
aiocat | Sciencx Wednesday February 16, 2022 » I made a programming language without any knowledge.., viewed ,<https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/>
VANCOUVER
aiocat | Sciencx - » I made a programming language without any knowledge.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/
CHICAGO
" » I made a programming language without any knowledge.." aiocat | Sciencx - Accessed . https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/
IEEE
" » I made a programming language without any knowledge.." aiocat | Sciencx [Online]. Available: https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/. [Accessed: ]
rf:citation
» I made a programming language without any knowledge. | aiocat | Sciencx | https://www.scien.cx/2022/02/16/i-made-a-programming-language-without-any-knowledge/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.