• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How realistic are the examples in Language Implementation Patterns

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read from amazon that the implementation patterns are in Java. How realistic is this? Are there any programming languages around which are implemented in java? Or did I get the whole implementation pattern confused with the implementation of the language itself? What is the most widely used languages for implementing languages? Will this book get me started in writing a PL for robotics (for example)? Thanks and Welcome to Terence Parr. Welcome to javaranch.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that "language" is not the same as "programming language". The book deals specifically with domain specific languages, many of which have been implemented in Java (and in all kinds of other programming languages). If you visit the web sites of the major Java parser generators (Antlr, JavaCC, SableCC) you'll see the range of grammars for which parsers have been built.
 
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ashok,
I may be wrong, but I believe much of Groovy is written in Java.
Burk
 
author
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ashok C. Mohan wrote:I read from amazon that the implementation patterns are in Java. How realistic is this? Are there any programming languages around which are implemented in java? Or did I get the whole implementation pattern confused with the implementation of the language itself? What is the most widely used languages for implementing languages? Will this book get me started in writing a PL for robotics (for example)?



Hi Ashok, the book is about implementing new DSLs and general purpose programming languages. So, for example, to implement a PL for robotics (which I did in the 80s and was used by Renault to build cars), you could implement the PL in any language including assembly language. I had to choose an implementation language for the book so that I didn't flip back and forth between a number of implementation languages.

The choice of implementation language often depends a great deal on how efficient the language application has to be. For example, I built a byte code compiler and a byte code interpreter in C for the robot control language. Using C let me make a fairly efficient interpreter, but I could've used [shudder] Fortran to write the compiler itself.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Terrance,

I don't think it's what he meant by realistic, but I'm wondering if the examples are all very simple (so that we can understand them easily) or if there are a few complex enough that they could be used for real-world (read business) solutions.

Thanks,
Burk
 
Terence Parr
author
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is a realistic language used is implementation mechanism. The examples are not trivial but are not as big as one might want an industry. Their medium-size is a good compromise between learning and completeness.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Terence Parr wrote:Java is a realistic language used is implementation mechanism. The examples are not trivial but are not as big as one might want an industry. Their medium-size is a good compromise between learning and completeness.



So they're complex enough to prove they can do some "heavy lifting" while being simple enough for a beginner to grok?

Do they include error handling (how to deal with improper syntax, or other errors) or do they assume correct input and leave the implementing the error handling as an exercise for the reader?

Burk
 
Terence Parr
author
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Burk Hufnagel wrote:Do they include error handling (how to deal with improper syntax, or other errors) or do they assume correct input and leave the implementing the error handling as an exercise for the reader?Burk



It talks about error handling in the parsing patterns but the (ANTLR reference talks more about this as error handling is often highly specific to a tool. It DOES, however, talk about how to compute type information and detect operations with incompatible types. Semantic errors not syntax errors.
 
Burk Hufnagel
Ranch Hand
Posts: 883
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Terence Parr wrote:It talks about error handling in the parsing patterns but the (ANTLR reference talks more about this as error handling is often highly specific to a tool. It DOES, however, talk about how to compute type information and detect operations with incompatible types. Semantic errors not syntax errors.



That's good, it always bothers me then I can't find any samples of how to deal with error conditions when I'm learning something new. Makes me wonder if the author was afraid that showing what it looks like in the real world would scare off the reader. What's worse, many developers will use the example as a pattern for how they should implement something and not include any error handling capability at all.

Thanks, Terrence.

Burk
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic