[colug-432] Compiler compiler?

Steve Roggenkamp roggenkamps at acm.org
Wed Sep 5 18:37:45 EDT 2012

You can define the syntax such that it will match errors and consume
tokens until it reads a token and can recover.  So, as an example, you
might define statements in the language something like

  <statement> := <expression> ';'
  <expression> := <assignment>
                     |   <for_statement>
                     |   ...
                     |  <ERROR_EXPRr>

In this definition, <ERROR_EXPR> will consume input until it hits a
semicolon (;), at which point it will recognize the ERROR_EXPR
production and proceed.  It might cause problems later on if several
things might match it, but at this point the parsing is already
indicated an error, so at this point you're just trying to get as many
errors flagged as possible so you don't go through a seemingly
infinite number of attempts to get things correct.

There's a number of parser generators out there, although with
relatively simple languages you can write a recursive descent parser
quickly.  It's the semantics that usually take the larger amount of
work to implement a language.


On Wed, Sep 5, 2012 at 5:38 PM, Vince Herried <Vince at planetvince.com> wrote:
> I write programs in a language called LInden Scripting language (LSL), that
> runs on Second Life.
> Their program development environment consisted of a simple text editor and
> the save command.
> If one makes an error it is only found at save time, and them it only finds
> a single error.  Obviously this makes it
> time consuming to develop complex programs.
> Some one created a very fancy Eclipse plugin for LSL, called LslPlus.
> Unfortunately this project seems to have died.
> The plugin available from sourceforge is written in Haskell and Java.
> Trying to update it I get into a huge prerequisite
> list.  Eg, to compile module A, requires library component x1 version > 1.0
> and < 1.5.  So when I try to compile
> that x1 component I get another grumble.  After chasing down six or seven
> arrrg.  To top it off these things are
> written in Haskell.
> So finally my question.  Can one of the compilers generated by a
> compiler-compiler detect multiple syntax errors
> in one shot?  I don't really want it to generate any executable code,  just
> want it to know about all the built in
> functions, their arguments and the language syntax which is some what
> similiar to C with do, for and if constructs
> etc...  It also contains some strange data types as follows.
> vector  VectorVariable = <1.2, 3.4, 5.6>;
> and
> rotation RotationVariable = <1.2, 3.4, 5.6, 6.7>;
> and
> list ListVariable = ["list text",2.3,<1.2,3.4,5.6>];
> other examples:
> if ( a == b ) { a += 1; }
> // this is a comment
> for (i=0;i<n;i++) {
> //blah
> }
> on_rez(integer int) {
> // do something cool
> i++;
> llOwnerSay("Entered \"on_rez()\"");
> }
> So compiler compiler to  syntax check all in one shot???
> ---
> Vince
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432

More information about the colug-432 mailing list