Skip to content

This is a compiler for the IBM XPL language. It compiles into s390 code

Notifications You must be signed in to change notification settings

moshix/XPLcompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

A Compiler for the IBM XPL language


This is a compiler for the IBM XPL language (see here: https://en.wikipedia.org/wiki/XPL). For a while IBM made a compiler available for this system programming language and then they stopped.
This compiler compiles the IBM XPL syntax into S/390 code. This compiler is written in IBM PL/I which is an industry semi-standard. It has compiled on my z/OS 2.1 system with the IBM Enterprise PL/I compiler 4.3.1 just fine.
It is supplied as is, without any gurantee.

More Information about the XPL language (incl syntax and sample code)

http://teampli.net/XPL/
Sample Code:

*  This program reads n cards (n= 100), sorts them in
    alphabetical (collating) order and prints them. */

declare n literally '100';
declare cards (n) character, (i,j,k) fixed, temp character;

output = 'Input cards:';
do i = 1 to n;
   output, cards(i) = input; /* read and list    */
end;

k,l = n;
do while k <= l;             /* bubble sort loop */
    l = - n;
    do i = 1 to k;
       l = i - 1;
       if cards(l) > cards(i) then
           do;
               temp = cards(l);
               cards(l) = cards(i);
               cards(i) = temp;
               k = l;
           end;
    end;
end;                         /* of sort loop */

output = 'Sorted cards:';
do i = 1 to n;
    output = cards(i);
end;



thanks

moshix

August 2020





Backus-Naur Form of XPL

BNF Definition of the XPL Language


		::=  EOF

	::= 
			  |  

  		::= 
			  | 

  	::=  ;
			  |  ;
			  |  ;
			  |  ;
			  |  ;
			  |  ;
			  |  ;
                          | ;
			  |  

       	::=   
			  |   
			  |  

		::= IF  THEN 

	        ::=  ELSE

                 ::=  

            ::= DO ;
                          | DO  ;
                          | DO  ;
                          | DO  ;
                          |  

       ::=    

     ::= TO 
                          | TO  BY 

	        ::= WHILE 

         ::= CASE 

  ::=   

        ::=  ;
                          |   ;
                          |   ;
                          |    ;

        ::=   PROCEDURE

        ::=   )

        ::=  (
                          |   ,

                ::= END
                          | END 
                          |  

      ::=  :

      ::= RETURN
                          | RETURN 

        ::= CALL 

       ::=  

                 ::= GO TO
                          | GOTO

 ::= DECLARE 
		          |  , 

   ::= 
                          |  LITERALLY 

      ::=  
                          |   ) 
                          |  

                  ::= FIXED
                          | CHARACTER
                          | LABEL
                          |   )

              ::= BIT (

            ::=  (

 ::= 
                             |   )

          ::= (
                             |   ,
 
             ::=   )

             ::= INITIAL (
                             |   ,

               ::=   
                             |  

                  ::= =

                ::=  ,

               ::= 
                             |  | 

           ::= 
                             |  & 

        ::= 
                             | ¬ 

          ::= 
                             |   

                 ::= =
                             | <
                             | >
                             | ¬ =
                             | ¬ <
                             | ¬ >
                             | < =
          		     | > =

        ::= 
			     |  ||  

    ::= 
                             |  + 
                             |  - 
                             | + 
                             | - 

                     ::= 
                             |  * 
                             |  / 
                             |  MOD 

         ::= 
                    | 
                    | (  )

        ::= 
                    |   )

  ::=  (
                    |   ,

        ::= 
                    | 


The following definitions are hardcoded into the lexical scanner:


	  ::= 
                    | 

         ::= 
                    |  

   ::= 0|1|2|3|4|5|6|7|8|9

      ::= ""

        ::= 
		    | 
                    |  

       ::= (1)
                    | (2)
                    | (3)
                    | (4)

  ::= 
                    |  

    ::= 0|1

 ::= 
                    |  

   ::= 0|1|2|3

   ::= 
                    |  

     ::= 0|1|2|3|4|5|6|7

     ::= 
                    |  

       ::= 0|1|2||3|4|5|6|7|8|9|A|B|C|D|E|F

          ::= ''
                    | ''

      ::= 
                    |  

       ::= ''
                    | {any EBCDIC character other than ' }

      ::= 
                    |  
                    |  

    ::=  | 

          ::= A|B|C ... |Z|a|b|c ... |z

   ::= 0|1| ... |9

 ::= _ | @ | # | $

No identifier can exceed 256 characters.  The following reserved words cannot be
used as identifiers:
BIT	DECLARE 	GOTO	PROCEDURE
BY	ELSE	IF	RETURN
CALL	END	INITIAL	THEN
CASE	EOF	LABEL	TO
CHARACTER 	FIXED	LITERALLY 	WHILE
DO	GO	MOD


           ::=   

   ::= /*

   ::= */

   ::= {any string of valid characters which does not contain a }

A $ within a comment specifies that the next  is a control character.
There are 256 control toggles corresponding to the 256 valid character codes.  
Each toggle can have a value true or false.  
When $ is encountered, the value of the corresponding toggle is complemented.  
Currently defined toggles are:
toggle	Description	initial
B	Interlist emitted byte codes in hex.	off
D	Print statistics and symbol table.	on
E	Interlist emitted assembly code.	off
L	List compiled program.	on
M	List program without auxiliary information.	off
N	Warn if procedure args¬=parameters.	off
S	Dump symbol table at end of each procedure.	off
T	Begin tracing.	 
U	Terminate tracing.	 
Z	Allow program to execute in spite of errors.	off
|	Set margin. Input scan will be terminated at column containing the |	 

About

This is a compiler for the IBM XPL language. It compiles into s390 code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published