Hi,

Saw your question on irc.

Attached is a modification on your `simple' language that demonstrates
transparent source locations.

The explicit, Bison-like locations work just like they do in Bison...eg
something like:

    ;; helper
    (define (note-location ast loc)
      (when (supports-source-properties? ast)
          (set-source-property! ast 'loc loc))
      ast)

  (define (make-parser)
    (lalr-parser
    ;; ...
    ;; production rules
    (variable
     (type Identifier = expression semicolon) : `(variable ,$2 ,$1 
,(note-location `(expression ,$4) @3))
     (Identifier dot Identifier Identifier = expression semicolon) : `(variable 
,$4 (type ,$3 ,$1) ,(note-location `(expression ,$6) @5)))

Does that answer your question?

Greetings, Jan

Attachment: simple.scm
Description: Binary data

Attachment: spec.scm
Description: Binary data

-- 
Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

Reply via email to