If you decide to go the compiled route, also consider just writing a translator from your language to a compiled one, such as C or C++. Then you don't have to implement a compiler at all which will save you a ton of time.
On Fri, Apr 9, 2010 at 12:09 PM, Andreas Stefik <[email protected]> wrote: > That's hard to answer without knowing context. Compilers are tricky > things. For example, you might make a simple evaluator that will > inevitably run very slowly, but do the job you need. Or, you might > make something that generates code that ultimately be compiled into > very fast C code to be compiled by a GCC compiler --- or who knows > what. > > That's why I'm saying it depends on context. What problem are you > trying to solve with your DSL? > > Stefik > > On Fri, Apr 9, 2010 at 1:59 PM, William v Doorn <[email protected]> > wrote: > > Andreas, > > > > Well, I can already execute some code and evaluate it, but is this really > > the way to do it? e.g. could I use this as interpreter, or do I need a > fully > > different approach? (see the file I attached) > > > > Thanks > > > > William van Doorn > > > > > > > > 2010/4/9 Andreas Stefik <[email protected]> > >> > >> William, > >> > >> This is a complex question to answer, and it really depends on your > >> needs. For example, creating a whole compiler from scratch is > >> difficult, but possible. We have our own compiler (with an ANTLR front > >> end), that integrates our own custom language, called HOP, which is > >> basically a novice programming language we distribute to schools for > >> the blind. Our implementation is on sourceforge and is under GPL2, so > >> you are welcome to look at it (Search for "Sodbeans"). We also > >> integrate our custom compiler into NetBeans. > >> > >> On the other hand, if your needs allow it, you can also do things like > >> have your antlr grammar generate java byte code or assembly directly, > >> which is sometimes easier, again depending on what you need. And very > >> simple interpreters for very simple languages aren't too tough, if you > >> know what you are doing, and depending on your requirements. > >> > >> Hope that gives you some tips, at least. Short answer: Yes, it's > >> definitely possible, but it depends on your goals, and it's typically > >> not something you would bang out in a weekend. > >> > >> Andreas Stefik, Ph.D. > >> Department of Computer Science > >> Southern Illinois University Edwardsville > >> > >> On Fri, Apr 9, 2010 at 1:44 PM, William v Doorn < > [email protected]> > >> wrote: > >> > Hello all, > >> > > >> > I've been reading the The definitive ANTLR book and I've made my own > >> > small > >> > language using the AST strcuture. > >> > > >> > Now I was wondering, is it hard to make my own compiler/interpeter for > >> > this? > >> > I can feed files and such to it, but how would I make my own > >> > interpreter/compiler? > >> > > >> > Thanks, > >> > > >> > William van Doorn > >> > > >> > List: http://www.antlr.org/mailman/listinfo/antlr-interest > >> > Unsubscribe: > >> > > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > >> > > > > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
