+ 2
What's the best coding language to make a coding language?
I want to make a coding language that is so easy for beginners. I am thinking of either using C or Python.
5 ответов
+ 5
Hello, mahir !
The compiler can be written in any language.
The code will consist of several modules.
1. Lexer - converts the source text into a sequence of tokens.
a = b + 1; will turn into something like
{variable ("a"), assign, variable ("b"), add, number ("1")}
2. The parser is built on the basis of grammar. Converts a sequence of tokens into a tree.
assign / \ var ('a') add / \ var ('b') number(1)
3. Further bypassing the resulting tree, we generate the code
Different methods are painted in dragonbook
+ 2
you can make it c-based using flex and bison (a lexer and a parser), although i would recommend learning ASM and creating it from scratch.
+ 2
i love python and c therefore tweaking their syntax a little bit and adding a few ideas is okay
+ 1
making a program is much easier said then done...good luck though!