addPosInfo adds position information to an AsFix2ME parse tree.


The following syntax definition defines a tiny language of assignments and expressions.

  module Main
    context-free start-symbols Stm*

    sorts Id IntConst
    lexical syntax
      [\ \t\n]  -> LAYOUT
      [a-zA-Z]+ -> Id
      [0-9]+    -> IntConst

    sorts Stm
    context-free syntax
      Id ":=" Exp -> Stm {cons("Assign")}

    sorts Exp
    context-free syntax
      Id        -> Exp {cons("Var")}
      IntConst  -> Exp {cons("Int")}

      Exp "+"  Exp -> Exp  {left, cons("Plus")}

Generate a parse table:

  > sdf2table -i Foo.def -o Foo.tbl

Input file:

  x := 5
  y := x + 4
  z := x + y

Parse the input and have a look at the result in abstract syntax:

  > sglr -i foo.txt -p Foo.tbl | addPosInfo -p ./foo.txt -m | implodePT | pp-aterm


  • you must specify the path (-p) of the input file.
  • sglr must produce Asfix2ME. This happens if you pass no -2 argument.

Revision: r1.1 - 27 Aug 2004 - 08:02 - MartinBravenboer
Tools > ReleasePlan > ReleasePlan > AddPosInfo
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback