View Full Version : Creation of programming languages

08-01-2003, 01:00 PM
How does one create a programming language? Do they simple make up a syntax and create a compiler? How does the compiler make machine code? Thanks for the answers :D !

08-01-2003, 01:03 PM
Virtually impossible to answer those questions in one post - or one book for that matter. Look those topics up on www.google.com and have at it. There are a ton of sites that talk about this.

Randall Hyde's book also talks about how to build compilers, lexical analyzers, etc. You can get it at cs.webster.edu I think. Damn I always forget that link.

Just look up Randall Hyde's AOA on google and it will pop up.

08-01-2003, 01:05 PM
"make up syntax" is a complicated topic but suffice it to say that there are some tests it should pass. Proofs that it'll always work so to speak. This allows a compiler to be written. I hope you aren't on the "I wanna make a compiler" kick. If so, I wish you well :D

08-01-2003, 01:23 PM
"I wanna make a compiler"

lol, that is actually one of the projects i have to do my senior year in college for my comp sci major.

08-01-2003, 01:56 PM
If you're comp sci major, then I'm sure you'll learn more than you ever wanted to know about such things in a Programming Languages and/or Compilers course.... I know I sure did :P

08-01-2003, 03:39 PM
There's a program on CNet that lets you do this quite easily, but I imagine it's mostly cookie-cutter options type things. I've got a book on assembly that gives you the machine code for all sorts of things. I was going to make a CGI assembler and put it on the web, but I couldn't figure out how to get operands and stuff like that coded in, so I gave up. DOing web programming as a job soon, (like, starting next month - hence the crappy homepage for the time being) I'd love to have something like that, so if anyone solved this problem, like CS majors, please contact me.

08-02-2003, 06:46 PM
The problem is not getting operands, the problem is the CISC set. It's so complex and the encoding gets very involved. But it can be done via bit patterns and things like cellular automata. I've not attempted it but you basically break expressions down and find commonalities to them. After a few base expressions, you can then recursively search through them to create new complex expressions - since complex expressions are really just multiple base expressions.