Skip to content

Instantly share code, notes, and snippets.

@mye-creator
Last active November 29, 2020 05:18
Show Gist options
  • Save mye-creator/2005ed1b1f65e76a812835b0fa4ef888 to your computer and use it in GitHub Desktop.
Save mye-creator/2005ed1b1f65e76a812835b0fa4ef888 to your computer and use it in GitHub Desktop.
How to make your programming language from zero?

How to make your programming language with JavaScript (Part 1)

Have you thought that if you create your own programming language, you can be proud of yourself? Sadly, it's not easy to make it. But today we will start making it from zero!

What do you need?

We need:

  • CMD console (ConEmu)
  • Node.js (Install the LTS version (recommended))
  • Text Editor (I'm using Sublime Text Editor)

How to install node.js?

Go to here and install lastest LTS version. When it's done, run the .msi file and agree with all and then wait until it's downloaded.
If installer is done, run ConEmu cmd and choose the cmd (basic cmd, not Git Bash or etc). And now you will have one tab with cmd console. You should have $ at the start of line, so type this: node -v And if the version appears, congratulations! You installed node.js!

Starting

Now you just need to create a folder called whatever you want, and then create another folder called "compiler" in the same folder. Create index.js file in the compiler folder by creating txt file and changing the file format. (Click here to know, how to change file format if you can't do it)

Create modules folder in compiler folder, and create lexer.js file. Files locations: index.js : Language/compiler/index.js lexer.js : Language/compiler/modules/lexer.js If file locations in your folder is correct, then bye-bye in part 1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment