I would like to create my own programming language. Maybe not exactly a programming language from scratch but maybe base it on another language.
I've heard of Yacc. So, I installed Flex and Bison. But I do not understand how to make a compiler with it. I have made the Hello world
project in it, but how would I make a compiler in it?
Are there any easy ways of creating a small programming language, I have heard of translating a language as in taking, e.g., Write()
and making the computer understand it as Print()
.
Is this be possible?.
You might consider learning to build a compiler from a fabulous 1964 (yes, you read that right) paper META II: A Syntax-Oriented Compiler Writing Language on how to build "meta compilers".
This paper contains, in 10 pages, a compiler writing philosophy, a definition of a virtual compiler instruction set that is easy to implement, a compiler-compiler, and an example compiler built using the compiler-compiler.
I learned initially how to build compilers from this paper back in 1970 odd. It is astonishing how clever and conceptually simple it is.
If there was a paper I'd make every computer science student read, this would be it.
You can get the paper, see a tutorial and an implementation of MetaII in JavaScript here. The guy behind the tutorial is Dr. James Neighbors, source of the term "domain analysis".