Discuss Writing own programming language in the Other Programming Languages forum on Dev Shed. Writing own programming language A place for discussing programming languages not covered in specific forums such as Assembler, COBOL, etc. - you get the idea.
Time spent in forums: 5 Days 22 m 28 sec
Reputation Power: 201
Writing own programming language
Can anyone give me any tips on writing my own programming language?
I have lokked at YACC, but I dont really get it
Without question, the greatest invention in the history of mankind is beer. Oh, I grant you that the wheel was also a fine invention, but the wheel does not go nearly as well with pizza. (Dave Barry's Bad Habits, Dave Barry)
Last edited by amfr : December 16th, 2005 at 04:54 PM.
Time spent in forums: 1 Week 1 Day 18 h 26 m 52 sec
Reputation Power: 41
I admit to having done a very simple scripting language, but it wasn't very functional. To be honest, I don't know what to point you to. People who conceive their own programming languages usually have umpty years of experience.
Location: Woodland Hills, Los Angeles County, California, USA
Time spent in forums: 2 Months 8 h 53 m 6 sec
Reputation Power: 4080
I have one that I wrote in around 550 lines of C++ code with comments. Let me know if you want the source. YACC takes the drudgery of writing two parts of an interpreter or compiler, which is the lexer and the parser. I'll write a bigger post about writing a compiler shortly.
__________________ Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
Time spent in forums: 6 Months 2 Weeks 2 Days 1 h 34 m 35 sec
Reputation Power: 8490
If I was to make a language I'd make it very specific. For example, I'm of the mind to write an object oriented music score generating language, it's something I've thought about for a while. A way of making objects out of some of Schillinger's concepts in his volumous System of Musical Composition which can programmatically be manipulated, likely generating MIDI output which can then be fed into whatever sequencer from there.
I can't imagine a single person making a full blown multi-purpose language in this modern day ...
Time spent in forums: 20 h 8 m 58 sec
Reputation Power: 9
First decide whether you are going to develop compiler or interpreter.
A compiler converts source language into some another language. For example, C compiler converts C program into a program in machine language. Interpretor simply executes the instruction without any conversion.
For designing compiler, I would like you to learn flex and yacc. It will simplify your work. Also, if you are converting it to machine language than go through the instruction-opcode table. This is mentioned in the spec of CPU for which you are designing the compiler. Also, depending on your OS, you will have to go through the format of executable file. For example, linux executable file will have machine lanuguage code written as per POSIX format.
Regarding interpreter, I don't know much about how to implement it. But interpreters are easier to implement and also helps in making your language OS independent.
You can refer to following post:
Time spent in forums: 1 Week 6 Days 11 h 19 m 55 sec
Reputation Power: 150
Originally Posted by midfielder
What is the benefit of creating your own language? What application cannot be created with the modern day languages?
The thing is, anything is possible with many low-level programming languages of today, say Assembler. But would you use Assembler for everything? You won't write a forum in Assembler.
But if you were writing a chess program for grandmaster tournments, you wouldn't use PHP. You'd go back to the basics and use the fastest there is.
Some day in the future, a door may open to a brand new area of computing, a new logic, a new thought pattern, that requires the invention of a brand new language to complement and make full use of the new technology.