Re: Suggestion for dynamic grammar/parser - pls advise



On 29 Mar 2007 01:02:19 -0400, John Sasso wrote:

Suppose we have a language (for example, a language to describe the
configuration of a server), which is versioned (1, 2, 3, etc...);

[...]

As a very simple example, suppose version 1 of our language (L_1) can
recognize the following program statement:

set disk id 1 name "system" nparts 4

Why don't you treat it as a subprogram call instead of a statement? That
would fix you language. The variety of fields in the statement looks much
like a record aggregate passed to the subprogram Set. The language "change"
in your example is basically a change of some record type of which
aggregate is passed to Set. This could be easily made by swapping the
library package, leaving both the parser and the code generator intact.

My thought is that implementing a parser based on a dynamic
grammar/parser scheme is the answer (I am not an expert on compiler
design or theory).

(who will write the code generator?)

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Instr()
    ... F90/95 and F2003 have very similar sections differing only in inclusions for newer language elements and editing. ... IF there were a Standard for VB it would contain definitions quite similar although not identical because of syntax and implementation differences. ... A subprogram is a program unit that has a FUNCTION, SUBROUTINE, or BLOCK DATA statement as its first statement. ... Subroutines, external functions, statement functions, and the intrinsic functions are called procedures. ...
    (microsoft.public.vb.general.discussion)
  • Re: YAPL - Yet Another Programming Language
    ... This new language not only differs from existing ones by new features ... preventing bad programmer habits by omitting features which are outdated. ... In the proposed new joint language for the world (codename YAPL) ... There is no macro feature since this mechanism is too similar to the subprogram feature. ...
    (comp.lang.c)
  • Re: YAPL - Yet Another Programming Language
    ... is needed for the benefit of the whole mankind in the 21st millenium. ... This new language not only differs from existing ones by new features ... and paradigms but which also brings real advantage by rigourously preventing bad programmer habits by omitting features which are outdated. ... There is no macro feature since this mechanism is too similar to the subprogram feature. ...
    (comp.lang.ada)
  • Re: Separate Compilation in Programming Languages
    ... Dirk Heinrichs wrote: ... The only problem is that there is no subprogram-aware version control system ... Several years ago I implemented something of the sort, by writing some scripts to chop version "diff" reports per Ada subprogram, using fairly simple patterns to match the start and end of subprograms. ... Editors do it for the major languages, but not for every little language someone has invented. ...
    (comp.lang.ada)