gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnu-arch-users] Re: new language, arch, furth, etc.


From: Tom Lord
Subject: [Gnu-arch-users] Re: new language, arch, furth, etc.
Date: Tue, 20 Jul 2004 08:02:41 -0700 (PDT)


(Language design for version variables, continued)


* First Cut: Simple Assignments

  The very least a configuration language has to do is associate
  names with values.   A language providing simple assignments 
  fits that bill.  Here is a (slightly informal) grammar for
  such a language:

        <program> := <assignment>*
        <assignment> := "(" "define" <name> <value> ")"
        <name> := ``an identifier''
        <value> := ``a value''

  Here are is a valid program using that grammar:

        (define x 42)
        (define message "hello world")

  The informal grammar, to be made formal, needs definitions
  for:

        ``an identifier''

  and 
        ``a value''

  
* Identifiers

  Identifier syntax is a fairly arbitrary choice but there are
  some considerations to keep in mind:

        1. The lexical syntax of identifiers must not create
           syntactic ambiguity in programs

        2. The language as a whole should be easy to lex and parse

        3. Identifiers are often used in more than one programming
           language: there should be a mapping from our languages
           variable names to those of, say, C, perl, python, and
           Scheme

        4. the syntax should be "extensible" in the sense that
           the grammar can expand in the future.   For that reason,
           it is probably best to _not_ make the set of identifier
           names as large as possible;  rather, some possible 
           identifiers should be left undefined (illegal tokens)
           for now.

  I drew on my personal tastes and experience and decided that
  identifiers in this language should be a subset of the identifiers
  in Scheme:

        <name> := <initial> <subsequent>*
        <initial> := <letter>
        <subsequent> := <letter> | "-" | <digit>

  For example, these are valid identifiers:

        diff3
        hello-world
        answer

  but these are not:

        3way-merge
        hello_world
  

-t





reply via email to

[Prev in Thread] Current Thread [Next in Thread]