DEV Community

Cover image for Making a Languague - Introduction

Posted on

Making a Languague - Introduction

1 - Because this project

After a long time studying, testing and creating interpreters and compilers, I get acceptable level in the subject, after a while I created languages ​​and projects that caught the attention of some people and of course beginners who wanted to learn how to create their languages ​​and after teaching several people and more and more people asking me, I decided to create this "manual" gathering all my knowledge and teaching to beginner developers who have doubts and even those who are at university and want a project to impress their teacher and their class.

2 - Why should I learn to create languages?

While large languages ​​need a team working on them to always get better, you can use that knowledge and create a language that makes your job and your friends' jobs easier. Why not create a language with a specific focus that helps you at work?

Furthermore, for every programmer, it is of paramount importance to understand how languages ​​work inside them.

3 - What languages ​​are we going to use and what do I need to know?

## What language?
We're going to use Python, which isn't that fast, but it's easy and we can teach most of the concepts without worrying about more complex syntaxes like C and Java.

## What do I need to know?

  • Of course, the basics of Python and C (don't worry, python is similar to C and if you want to implement in C surely if you know C you'll be able to write the code!)
    • Desirable to know how to read text files

4 - What will I learn?

You will learn 3 important parts:

  • Theory, here you learn how a language works
  • Creating a interpreter, here you create an interpreter that reads the code and executes
  • Creating a Compiler, Create a compiler that generates C code and call the C compiler to generate an executable
  • Comparison, comparing a compiler for assembly code to a compiler for C code

5 - Now what?

And now you're going to read this tutorial and finally understand how a language works and create your own languages!

And it's important to note that the compilers that we're going to look at here won't be 100% optimized because it would be a great job for you, but I'll try to write something about optimization.

Discussion (0)