Hi Stef,
I don't see unsupported syntax, just missing quotes around some tokens,
such as
** should be "**", + should be "+" in binary_adding_operator, etc...
BOOLEAN is probably <BOOLEAN>
Are you sure that the text you're joining isn't unquoted? It's hard to
requote everything as it should be, and not having the lexer definition
makes testing with SmaCC a bit painfull.
Thierry
Le 02/09/2013 12:18, Stéphane Ducasse a écrit :
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
;
'
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95