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

How to write SableCC Productions



I'm at the very first steps to write a compiler for the IEC 61131-3 PLC
language.
The following BNF fragment

il_instruction ::= [label':'][il_simple_operation | il_expression] EOL {EOL}

transformed to SableCC

Tokens
  colon = ':' ;
  endofline = cr | lf | cr lf;
  eol = endofline+;
Productions
  il_instruction = ( label colon ) ? ( il_simple_operation | il_expression )
? eol ;

Error message:
org.sablecc.sablecc.parser.ParserException: [6,36] TSemicolon TBar excepted.

[6,36] is the position of the first '?'
What is wrong with it?

Are there any tools to do the transformation? (there are about 250 other
productions to do)

TIA

Mit freundlichen Grüssen
Rainer Bittkau

Baumer Electric AG, Abt. Betriebsmittel
Hummelstrasse 17
Postfach
CH-8501 Frauenfeld
Tel. ++41 52 728 14 55; Fax. ++41 52 728 17 27
mailto:rbittkau@baumerelectric.com
http://www.baumerelectric.com