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

newbie help question



This is the first time I've defined a grammar in Metal, and
it was slow-going, but I have a grammar which "checks" out and
I generated a parser based on it.

I'm having a hard time interpreting lexical errors, however.
I am trying to load a file which should be in the language I defined,
and the error messages don't help me know what is wrong with my
input file.

The error message I got is this:

LEXICAL ERROR detected at line : 1  0n-3
** sun4 : machine error : segmentation fault

What does the "On-3" mean? Knowing that it's on line 1 is not of much help
to me since I am reading lots of records, each one which is on a line...
Also, why does it cause a segmentation fault?

The file I am trying to read is this:

06:32.5996  Usr 0  64  C SABME P=1                                           
06:32.6544  Net 0  64  R UA    F=1                                           

Thanks in advance, for any help you may be able to give...

The metal grammar I am using is this:

definition of Lapd is
   abstract syntax
      int  -> implemented as INTEGER ;
      letter  -> implemented as LETTER ;
      str  -> implemented as STRING ;

   rules
      <str> ::= %STR ;
         str-atom(%STR)
      <int> ::= %NUM ;
         int-atom(%NUM)
      <letter> ::= %LET ;
         letter-atom(%LET)
      <min> ::= <int> ;
         min (<int>)
      <sec> ::= <int> ;
         sec (<int>)
      <msec> ::= <int> ;
         msec (<int>)
      <c_or_r> ::= <letter> ;
         c_or_r (<letter>)
      <timestamp> ::= <min> ":" <sec> "." <msec> ;
         timestamp (<min>, <sec>, <msec>)
      <direction> ::= <str> ;
         direction (<str>)
      <unknown> ::= <int> ;
         <int>
      <pval> ::= "P=" <int> ;
         pval (<int>)
      <fval> ::= "F=" <int> ;
         fval (<int>)
      <preamble> ::= <timestamp> <direction> <unknown> <unknown> <c_or_r> ;
         preamble (<timestamp>, <direction>, <c_or_r>)
      <sabme> ::= "SABME" <pval> ;
         sabme (<pval>)
      <ua> ::= "UA" <fval> ;
         ua (<fval>)

   abstract syntax
      timestamp  -> MIN SEC MSEC ;
      entry_s  -> ENTRY + ... ;
      entry  -> PREAMBLE INTERACT ;
      preamble  -> TIMESTAMP DIRECTION C_OR_R ;
      sabme  -> PVAL ;
      c_or_r  -> LETTER ;
      ua  -> FVAL ;
      min  -> INT ;
      sec  -> INT ;
      msec  -> INT ;
      pval  -> INT ;
      fval  -> INT ;
      direction  -> STR ;
      ENTRY_S  ::= entry_s ;
      ENTRY  ::= entry ;
      PREAMBLE  ::= preamble ;
      TIMESTAMP  ::= timestamp ;
      INTERACT  ::= sabme ua ;
      C_OR_R  ::= c_or_r ;
      MIN  ::= min ;
      PVAL  ::= pval ;
      FVAL  ::= fval ;
      SEC  ::= sec ;
      MSEC  ::= msec ;
      DIRECTION  ::= direction ;
      INT  ::= int ;
      STR  ::= str ;
      LETTER  ::= letter ;
end definition

-- 
| Alan Ezust           ezust@iro.umontreal.ca      Montreal, Quebec, Canada |
|---------- Universite de Montreal    Departement d'informatique -----------|
  Tel. (514) 343-6111 ext. 3503                Fax. (514) 343-5834