Question:
how do I make a programming language?
?
2014-03-12 19:43:46 UTC
I tried java, c++, and a bunch of others but none of them made any sense. why so complicated? I want to make a programing language that doesn't require searching the whole internet to figure out. I have read everything free on the internet about programing and all the books about it at the library and the book store but they don't tell you how to program at all.

so... how do you make a programing language? is it hard to make one? any links will be helpful.
Six answers:
?
2014-03-13 04:47:47 UTC
If you want to design your own programming language, then the first stage is to define its grammar as a set of productions in a meta-language, such as BNF (Backus–Naur Form); at the same time, you need to define the semantics of the language (in other words, what each grammatical form actually does when executed).



To implement the language you need to produce a lexer and parser to analyse the incoming text and build a grammar tree of the user's source code. The traditional tools for this are "lex" and "yacc", but you can hand-code a lexer using a Finite State Machine, and a parser using the technique of "recursive descent".



The next stage is to write a code generator to synthesise the executable code. A simple technique when experimenting is generate the code in another high level such language such as C. A more advanced technique is to generate byte code for later interpretation, or directly generate machine code - but that is less popular these days. I would probably generate either Java byte code so that I can use the existing Java run-time system and the extensive Java APIs, or Microsoft CIL and the .NET framework.



The point I'm making is that there is a lot to learn, and it's not a task to be lightly undertaken. However, it is definitely possible and within the scope of a single person if you're sufficiently motivated.



Ironically, if you succeed you will probably not need your new language because you will have become an excellent programmer along the way.
The Shadowman
2014-03-12 20:18:03 UTC
If none of them make any sense, then take a look at machine code lol. Perhaps it makes more sense and understandable? The reason languages like C++ and Java are created was so that it is comprehensive and easy to read, making it as close to as human language as possible. And if it doesn't make any sense, then how would you go and create a computer language?



" I want to make a programing language that doesn't require searching the whole internet to figure out."



You serious? Do you realized that even 10+ experienced professional programmers look up notes and other sources like the internet for aid to figure out the correct code to write? Don't be naive.
plutonic
2014-03-12 19:55:45 UTC
Well, back in the olden days where I went to school and the computer still took up a whole building, we had something called META. What it was, was a Metacompiler or a compiler compiler, in other words, a language that you used to define compilers in.



I recall that it started out with such seemingly inane things as telling meta what a number or letter was. The line was something like:



Digit = 0|1|2|3|4|5|6|7|8|9



and so on. Then you would have to define what statements were. Then the different types of statements.





Are you sure you would not rather learn some kind of BASIC as a starter? There are still versions of QuickBasic out there that run in a DOS window on today's machines. One caveat is that they won't run on 64-bit machines. There is a work in progress out there called QB64 to cover this.
jen
2014-03-12 19:50:11 UTC
Let me get this straight here. You are struggling to learn any currently used programming languages yet you want to create your own? I'm sorry, I don't think that's wise. In my opinion Javascript seems to be the easiest to learn, next being PHP. That's my opinion. You cannot write a programming language without first understanding programming.....
anonymous
2014-03-12 20:04:17 UTC
if your struggling with just understanding the basics of programming there is no way you'll be able create your own. yes its hard to make. i would start with java or python. you could also try a very old programming method like basic or logo.
Savy Bones
2014-03-12 20:34:55 UTC
try learning Stencyl there is even a tutorial on Kongregate that teaches you to make a flash game. it's easy.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...