xquery/resources/my-parser.txt
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 02 Jul 2018 08:46:01 +0200
changeset 305 bad21c4f64bf
parent 296 ea3dbc023c80
permissions -rw-r--r--
Tagged Smalltalk/X 8.0.0

%start Main;

Main:
    A B? 
	{ 
      Transcript show: 'Main1'; cr;
                 show: '  '; show: '1'; cr;
                 show: '  '; show: '2'; cr;
                 show: '======================='; cr;
                 show: '======================='; cr.
    } ;

A:
   "a:" Digit
    {
      Transcript show: 'A: ';
                 show: '2'; cr.
      'A'.
    };

B:
   "b:" HexaOrIntegerLiteral
    {
      Transcript show: 'B: ';
                 show: '2'; cr.
      'B'.
    };

HexaOrIntegerLiteral:
    IntegerLiteral 
    {
        Transcript show: 'IntegerLiteral: ';
                   show: '1'; cr.
        '1'.
    }
    |
    HexaLiteral 
    {
        Transcript show: 'HexaLiteral: ';
                   show: '1'; cr.
        '1'.
    };

DigitOrIntegerLiteral:
    IntegerLiteral 
    {
        Transcript show: 'IntegerLiteral: ';
                   show: '1'; cr.
        '1'.
    }
    |
    Digit 
    {
        Transcript show: 'Digit: ';
                   show: '1'; cr.
        '1'.
    };

IntegerLiteral:
    <integer_literal>
    {
        Transcript show: 'IntegerLiteral: ';
                   show: '1'; cr.
        '1'.
    } ;

HexaLiteral:
    <hexa_literal>
    {
        Transcript show: 'HexaLiteral: ';
                   show: '1'; cr.
        '1'.
    } ;

Digit:
    <digit>
    {
        Transcript show: 'Digit: ';
                   show: '1'; cr.
        '1'.
    } ;