previous                     ToC                 next

 

2.      Source language

 

A source program for the RLA tool is made of three parts:

1. the declaration of the input symbols (the alphabet of the regular languages)

· a sequence of alphanumeric strings enclosed in “%{ and “%} brackets

2. the declaration of algebraic expressions

· a sequence of declarations enclosed in “%[ and “%] brackets

· each declaration associates an identifier (a “$ character followed by an alphanumeric string) with an expression based on input symbols, previously defined identifiers, and the character “& representing the empty string

· each expression can be:

· a regular expression enclosed in “[ and “] brackets

· the result of the set operations union (+), difference (-), intersection (#) and complement (!) over regular languages denoted by expressions enclosed in “[ and “] brackets

3. the evaluation of algebraic properties

· a sequence of questions of three possible types:

· is the regular language corresponding to a given identifier equal to (=?) the regular language corresponding to another identifier ?

· is the regular language corresponding to a given identifier a subset of (in?) the regular language corresponding to another identifier ?

· does a string of input symbols (possibly empty) enclosed in “( and “) parentheses  belong to (in?) the regular language corresponding to a given identifier ?

 

This is an example of RLA source program:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

You can directly run the RLA tool by saving in a same directory:

·  the rla.jar executable file

· the java-cup-11a.jar archive file

· the source program  Sample.rla .

Then run the application from the command line:

 

           java  -jar  rla.jar Sample.rla

 

The output reported in  TranslationResult.txt will be printed on the Java console.

 

 

 

 

previous                     ToC                 next

/********************************************************************

                            Sample RLA source program

*********************************************************************/

 

// input symbols

 

%{ a,b,c,d %}

 

// expression declarations

 

%[

  $1=[&|(a|a b)(a b)*]

  $2=[a|(a|a a)(b a)* b]

  $3=![$1] + [a (a b)*]

  $4=[$1] - [$2]

  $5=[$1] + [$2]

  $6=[$1] # [$2]

  $7=![[![$1]] # [![$2]]]

  $8=![[![$1]] + [![$2]]]

%]

 

// evaluations

 

  $1 =? $2

  $2 in? $1

  () in? $1

  (a a b a b) in? $1

  (a a a b a b) in? $1

  $5 =? $7

  $6 =? $8