I was getting acquainted with ANTLR, so had this question. If i am supposed to create a robust programming language like java or C#, would i use compiler tools to create it or write handwritten code for the compiler. Are there any practical examples of widely used languages created using compiler tools? Also are there performance issues with tool generated code versus handwritten compiler.
views:
41answers:
1I believe the Java compiler was/is written in C. Sun was a hardware company with a long investment in Unix, C, and Solaris, so that's what they knew best.
They might have used a C-based lex/parser like yacc and their grammar for Java. But it certainly wasn't ANTLR.
UPDATE: I was thinking that this was true for the first javac.exe, but I wasn't certain. A comment below said the current incarnations of the Java compiler are indeed written in Java.
You could use ANTLR as the basis for a language like Java or C# or another of your own devising. (I believe you can find Java grammars for ANTLR.)
You'd start with a grammar, lex and parse that into an abstract syntax tree (AST), and then emit your byte code or anything else from that.
Terrance Parr's latest book might interest you.