java parser generator
home
features
documentation
grammars
downloads
site originally designed by ninth ave
/**
 *
 *                Simplified 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
 *    and simplified to be completely ontology independent. 
 *
 *       THIS IS SUPERSET OF FIPA-SL as defined by FIPA.
 *
 *
 * 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.3 $
 */

Package nzdis.lang.sl;

Helpers

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

 l_par  = '(';
 r_par  = ')';
 dot = '.';
 q_mark = '?';
 colon = ':';
 hash = '#';
 minus = '-';
 plus = '+';
 star = '*';
 slash   = '/';
 semicolon = ';';
 pipe = '|';

 upper = ['A'..'Z'];
 lower = ['a'..'z'];
 digit = ['0'..'9'];

 special = [[hash + colon] + q_mark];
 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';
 
 sequence = 'sequence';
 set = 'set';
  
 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;
 q_mark = q_mark;
 colon = colon;

 semicolon = semicolon;
 pipe = pipe;

 not = not;
 and = and;
 or  = or;
 implies = implies;
 equiv   = equiv;

 true  = true;
 false = false;
 
 sequence = sequence;
 set = set;
  
 forall = forall;
 exists = exists;
 
 feasible = feasible;
 done = done;
 
 action = action; 
 iota = iota;
 any = any;
 all = all;
 dot = dot;

 integer = integer;
 float = float;

 word = ( [[[[0 .. 0xffff] - [0 .. 0x20]] - brackets] - special ] )  ( [[[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 =
    {negation} l_par not proposition r_par |
    {disjunction} l_par or [left]:proposition [right]:proposition r_par |
    {implication} l_par implies [left]:proposition [right]:proposition r_par |
    {equivalence} l_par equiv [left]:proposition [right]:proposition r_par |
    {existential} l_par exists variable proposition r_par |
    {universal}  l_par forall variable proposition r_par |
    {predicate} l_par predicate_symbol term+ r_par |
    {true} true |
    {false} false ;

  term = 
    {variable} variable |
    {function} functional_term |
    {action} action_expression |
    {identifying} identifying_expression |
    {constant} constant |
    {sequence} P.sequence |
    {set} P.set;
    
  identifying_expression = 
    {iota} l_par iota term proposition r_par |
    {any} l_par any term proposition r_par | 
    {all} l_par all term proposition r_par;

  functional_term = 
    {normal} l_par function_symbol term* r_par |
    {named} l_par function_symbol parameter+ r_par;

  constant = 
    {integer} integer |
    {float} float |
    {string} string ;

  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 |
     {tmp_and} and |
     {tmp_or} or |
     {tmp_not} not |
     {tmp_implies} implies |
     {tmp_equiv} equiv |
     {tmp_forall} forall |
     {tmp_exists} exists ; 

  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;

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

  parameter_name = colon string;

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