0

I'm new to programming.. But I would like to know how programming languages begin; I'm a Windows os user, and everything seems so vast. So, my question is, how do programmers get from that blank screen, to building their own programming language.

Also, are many new languages made? And are any made home-brewed?

James Litewski
  • 451
  • 2
  • 6
  • 16
  • The vast majority of programmers don't create their own programming language. They use an existing one. – Roger Lipscombe Apr 13 '11 at 10:43
  • I understand that, that wasn't my question.. – James Litewski Apr 13 '11 at 10:51
  • @Roger Lipscombe, they don't create their own languages, but they should start doing it. Language-oriented programming is much more powerful than any other known design methodology. – SK-logic Apr 13 '11 at 10:55
  • you could start right from NAND gates if you wanted an extremely bottom-up understanding http://stackoverflow.com/questions/1224617/how-can-i-build-a-small-operating-system-on-an-old-desktop-computer/1224961#1224961 – Sam Apr 13 '11 at 12:44
  • @SK-Logic, then we're in the realms of domain-specific languages, and while I hesitate to agree with you about "more powerful than any other known...", I agree that they're *extremely* useful. – Roger Lipscombe Apr 13 '11 at 12:45
  • @Roger Lipscombe, by "more powerful" I simply mean that this approach is an umbrella superset for all the other approaches, and thus, technically (not just subjectively) more "powerful". – SK-logic Apr 13 '11 at 12:54

3 Answers3

2

I don't totally understand your main question, but I can tell you that new programming languages are made every month :-) A lot of them never see the (public) light and a lot are very very specific to a smaller domain. But exact statistics are not available.

A list can be found on Wikipedia.

Rhapsody
  • 6,017
  • 2
  • 31
  • 49
  • Sweet! Thanks. How could I go about making my own language? Even if it is just some small unimportant project, and something that may never meet public approval. I just want to try things out for my own self. – James Litewski Apr 13 '11 at 10:44
  • When you're new to programming, I advice not to start creating your own programming language. It's way to complicated since you have to create a compiler as well. But you can find some useful info at http://msdn.microsoft.com/en-us/magazine/cc136756.aspx – Rhapsody Apr 13 '11 at 10:47
  • Thank you, I don't think I'll try right away, yes; although I want to look into it, mostly to get a just of what goes on behind the scenes. – James Litewski Apr 13 '11 at 10:53
  • 1
    @James Litewski, since you're new to programming you've got an advantage of being unspoiled yet by the wrong ways of thinking. So you can start learning with SICP ( http://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs ). Once you've done with this book, you'll know how to make your own languages. – SK-logic Apr 13 '11 at 10:57
2

To come up with a new programming language, you first need to come up with its formal grammar. Using the formal grammar you decide things like e.g. whether your true/false variable will be called bool or boolean or Boolean (over-simplified example).

Once the grammar is in place, you write a program in a known programming language which uses the rules of the grammar to take lines of code as input and produce machine executable code as output. Such a program is called a compiler. The machine executable code is usually specific to the machine it will run on e.g. if its an intel processor, then your compiler needs to produce intel compliant assembly language.

So the most essential Computer Science courses that you need to take before designing your own language are Computer Architecture, Automata Theory and Compiler Construction, then you need to learn a few things about the assembly language of the hardware on which you plan to run your programs and finally a low-level programming language like C which can help you write your new compiler.

Yasser
  • 1,808
  • 12
  • 18
  • 1
    I think that grammar (and syntax in general) is the least important part of a programming language. It is just a bad and sticky tradition that all the compiler construction textbooks devote at least half of their pages to parsing. – SK-logic Apr 13 '11 at 10:59
  • 1
    What would you rather suggest then? – James Litewski Apr 13 '11 at 11:02
1

To write a program you need a program!

Here's what you do: 1) Decide what your language will look like (the grammar) 2) Write a parser (turn the text the programmer types into a parse tree) 3) Turn the contents of the parse tree into the ones and zeros that your target CPU understand. 4) Package this all up into the executable files your OS expects.

James
  • 9,064
  • 3
  • 31
  • 49