java parser generator
home
features
documentation
grammars
downloads
site originally designed by ninth ave
/**
 *
 *                   FIPA-SL grammar.
 *
 *              This is grammar file of:
 *
 *    FIPA SL Content Language Concrete Syntax
 *    updated according to the document XC00008D
 *    see http://www.fipa.org
 *
 * This file is a SL parser source file for SableCC
 * (Sable Compiler Compiler by Etienne Gagnon and others) 
 * which can be obtained at:    http://sourceforge.net/projects/sablecc
 * This file is used to produce SL parser with related classes
 * and data structures.
 *
 * This is part of the New Zealand Distributed Information Systems (NZDIS)
 * project, conducted at the University of Otago, Dunedin, New Zealand,
 * under supervision of Professor Martin Purvis and Doctor Stephen Cranefield.
 *
 *
 * Copyright (C) 1998-2001 Mariusz Nowostawski and others.
 * All rights reserved.  (see LICENSE and AUTHORS files)
 *
 * Contact:                
 * e-mail: mariusz@rakiura.org
 * 
 * This file is part of the nzdis-fipasl package.
 *
 *
 * Version 1.0 $Revision: 1.2 $
 */


Package nzdis.lang.fipasl;

Helpers

 tab = 9;
 cr = 13;
 lf = 10;
 eol = cr lf | cr | lf |;
 white = (' ' | tab | eol)+ ;

 l_par  = '(';
 r_par  = ')';
 eq     = '=';
 ineq   = '/=';
 less   = '<';
 eqless = '=<';
 more   = '>';
 moreeq = '>=';
 dot = '.';
 q_mark = '?';
 colon = ':';
 hash = '#';
 minus = '-';
 plus = '+';
 star = '*';
 percent = '%';
 slash   = '/';
 semicolon = ';';
 pipe = '|';
 
 upper = ['A'..'Z'];
 lower = ['a'..'z'];
 digit = ['0'..'9'];

 special = [[[hash + colon] + [minus + q_mark]] + plus];
 brackets = [l_par + r_par];

 integer = minus? digit (digit)*;
 float = minus? digit (digit)* '.' digit (digit)* (('E' | 'e') ('+' | '-')? digit (digit)*)?;

 not = 'not';
 and = 'and';
 or  = 'or';
 implies = 'implies';
 equiv   = 'equiv';
 
 true  = 'true';
 false = 'false';
 
 member   = 'member';
 contains = 'contains';
 result   = 'result';
 
 cons   = 'cons';
 first  = 'first';
 rest   = 'rest';
 nth    = 'nth';
 append = 'append';
 union  = 'union';
 intersection = 'intersection';
 difference = 'difference';
 sequence = 'sequence';
 set = 'set';
  
 holds = 'holds';
 forall = 'forall';
 exists = 'exists';
 
 feasible = 'feasible';
 done = 'done';
 
 action = 'action'; 
 iota = 'iota';
 any = 'any';
 all = 'all';
 
 
 
Tokens

 line_comment = '/' '/' [[0 .. 0xffff] - [cr + lf]]* eol |
                ';' [[0 .. 0xffff] - [cr + lf]]* eol ;

 multiline_comment = '/' '*' [[0 .. 0xffff] - ['*' + '/']]* '*' '/' ;

 string_literal = '"' ([[0 .. 0xffff] - ['"' + '\']] | '\'[0 .. 0xffff])+ '"';

 l_par  = l_par;
 r_par  = r_par;
 eq     = eq;
 ineq   = ineq;
 less   = less;
 eqless = eqless;
 more   = more;
 moreeq = moreeq;
 q_mark = q_mark;
 colon = colon;
 hash = hash;
 minus = minus;
 plus = plus;
 star = star;
 percent = percent;
 slash   = slash;
 semicolon = semicolon;
 pipe = pipe;
 
 not = not;
 and = and;
 or  = or;
 implies = implies;
 equiv   = equiv;
 
 true  = true;
 false = false;
 
 member   = member;
 contains = contains;
 result   = result;
 
 cons   = cons;
 first  = first;
 rest   = rest;
 nth    = nth;
 append = append;
 union  = union;
 intersection = intersection;
 difference = difference;
 sequence = sequence;
 set = set;
  
 holds = holds;
 forall = forall;
 exists = exists;
 
 feasible = feasible;
 done = done;
 
 action = action; 
 iota = iota;
 any = any;
 all = all;
 dot = dot;
 date_time_seperator = 'T';

 integer = integer;
 float = float;

 word = ( [[[[0 .. 0xffff] - [0 .. 0x20]] - brackets] + [special + digit]] )  ( [[[0 .. 0xffff]- [0 .. 0x20]] - brackets]  )*;

 white = white;



Ignored Tokens

 white, line_comment, multiline_comment;




Productions

  content = l_par content_expression+ r_par;

  content_expression =
    {identifying} identifying_expression |
    {action} action_expression |
    {proposition} proposition ;
    
  proposition = wff;
  
  wff = 
    {atomic} atomic_formula |
    {unary_logical_op} l_par unary_logical_op wff r_par |
    {binary_logical_op} l_par binary_logical_op [left]:wff [right]:wff r_par |
    {quantifier} l_par quantifier variable wff r_par ;
    
  unary_logical_op =
    {not} not;
    
  binary_logical_op = 
    {and} and |
    {or} or |
    {implies} implies |
    {equiv} equiv;
    
  atomic_formula = 
    {proposition_symbol} proposition_symbol |
    {predicate_symbol} l_par predicate_symbol term+ r_par |
    {binary_term} l_par binary_term_op [left]:term [right]:term r_par |
    {true} true |
    {false} false ;
    
  binary_term_op = 
    {eq} eq |
    {ineq} ineq |
    {more} more |
    {moreeq} moreeq |
    {less} less |
    {eqless} eqless |
    {member} member |
    {contains} contains |
    {result} result;
    
  quantifier = 
    {forall} forall |
    {exists} exists;
    
  term = 
    {variable} variable |
    {functional} functional_term |
    {action} action_expression |
    {identifying} identifying_expression |
    {constant} constant |
    {sequence} P.sequence |
    {set} P.set;
    
  identifying_expression = 
       l_par referential_operator term wff r_par;

  referential_operator = 
    {iota} iota |
    {any} any | 
    {all} all;

  functional_term = 
    {cons} l_par cons [left]:term [right]:term r_par |
    {first} l_par first [right]:term r_par |
    {rest} l_par rest [right]:term r_par |
    {nth} l_par nth [left]:term [right]:term r_par |
    {append} l_par append [left]:term [right]:term r_par |
    {union} l_par union [left]:term [right]:term r_par |
    {intersection} l_par intersection [left]:term [right]:term r_par |
    {difference} l_par difference [left]:term [right]:term r_par |
    {arithmetic} l_par arithmetic_op [left]:term [right]:term r_par |
    {f1} l_par function_symbol term* r_par |
    {f2} l_par function_symbol parameter+ r_par;

  constant = 
    {numerical} numerical_constant |
    {string} string |
    {datetime} datetime;

  numerical_constant = 
    {integer} integer |
    {float} float;

  variable = q_mark string;

  action_expression = 
    l_par action agent term r_par |
    {sequence} l_par pipe [left]:action_expression [right]:action_expression r_par |
    {alternative} l_par semicolon [left]:action_expression [right]:action_expression r_par;

  proposition_symbol = string;

  predicate_symbol = string;

  function_symbol = string;

  agent = term;

  sequence = l_par T.sequence term* r_par;

  set = l_par T.set term* r_par;

  parameter = parameter_name parameter_value;

  parameter_value = term;

  arithmetic_op = 
    {plus} plus |
    {minus} minus |
    {multiplication} star |
    {division} slash |
    {modulo} percent;
  

  string = 
    {word} word | 
    {literal} string_literal;

  parameter_name = colon string;

  datetime = [date]:integer date_time_seperator [time]:integer;
  

/*
 datetime = Year Month Day "T" Hour Minute Second MilliSecond typeDesignator?;

Year = DecimalLiteral DecimalLiteral DecimalLiteral DecimalLiteral;

Month = DecimalLiteral DecimalLiteral;

Day = DecimalLiteral DecimalLiteral;

Hour = DecimalLiteral DecimalLiteral;

Minute = DecimalLiteral DecimalLiteral;

Second = DecimalLiteral DecimalLiteral;

MilliSecond = DecimalLiteral DecimalLiteral DecimalLiteral;

typeDesignator = ["a" - "z", "A"  "Z"];
*/

This site has been last updated by the web master on 2007/6/24.