Hi thierry

I imported the generated parsers (a student did a while ago on VW using Smacc).
The generated parser parse apparently the tests. 
Now when I regenerate the parser with Pharo I cannot get the Smacc compuling 
the parser.
I get a SmaCCParserError: Token not expected

do you have any idea what would not be supported in the Pharo/Squeak version 


#
#   Expression Parser
#=============================================

goal:                           expression* ;

expression:                     relation
                                ( (
        and
         | 
        and then
         | 
        or
         | 
        or else
         | 
        xor
        ) relation )*;

relation:                       simple_expression
                                sndPart?;

sndPart:                        relational_operator simple_expression |
                                (
        not
        )? (
        in range
         | 
        in
         type_mark);

simple_expression:              (unary_adding_operator)?
                                term (binary_adding_operator term)*;

term:                           factor (multiplying_operator factor)*;

factor:                         primary (
        **
         primary)? | 
        abs
         primary | 
        not
         primary; 

#<identifier> instead of name
primary:                        <numeric_lit> | 
        null
         | <string_lit> | <number> | 
                                <identifier> | <identifier>
        ''
        <identifier> | 
                                function_call | 
        (
         expression 
        )
        ;
                                                        #simplified

binary_adding_operator:         
        +
         | 
        -
         | 
        &
        ;
unary_adding_operator:          
        +
         | 
        -
        ;
multiplying_operator:           
        *
         | 
        /
         | 
        mod
         | 
        rem
        ;
relational_operator:            
        =
         | 
        /=
         | 
        <
         | 
        <=
         | 
        >
         | 
        >=
        ;

#=============================================================================

function_call:                  <identifier> ''identifier'' function_arguments 
''args''
                                { ADFunctionCall withElements: args withName: 
identifier } ;

function_arguments:             
        (
         expression (
        ,
         expression)* 
        )
        ;

#==== Declarations ===========================================================

discrete_range:                 range | subtype_indication; #discrete_?

  subtype_indication:           type_mark (constraint)? ;

   type_mark:                           type;

   constraint:                  range_constraint;

    range_constraint:           
        range
         range;

     range:                     range_attribute | (simple_expression 
        ..
         simple_expression);
 
      range_attribute:                  <identifier> 
        ''
         
        range
        ; #cf. 4.1.4

#==== Names ==================================================================

name:                                           simple_name       | <char_lit>  
|
                                                indexed_component | 
                                                slice             | 
selected_component |
                                                attribute; #operator_symbol

prefix:                                         name | function_call;

 simple_name:                           <identifier>;

 indexed_component:                     prefix 
        (
         expression ( 
        ,
         expression )* 
        )
         ;

 slice:                                 prefix 
        (
         discrete_range 
        )
        ;

 selected_component:                    prefix 
        .
         selector;

  selector:                             simple_name | <char_lit> | 
                                                
        all
        ; #operator_symbol

 attribute:                             prefix 
        ''
         attribute_designator;

  attribute_designator:                 simple_name (
        (
        <universal_static_expression>
        )
        )? ;

#==== Types: appendix c: package STANDARD plus more 
=========================================================
type:                           
        BOOLEAN
         | 
        REAL
         | 
        INTEGER
         | 
        FLOAT
         | 
        CHARACTER
         | 
        DURATION
         |
                                                
        STRING
         | 
        RAINBOW
         ;   
        
        '

Reply via email to