Structure of LynPlexS Programs

Objectives:

Having completed this section you should know about:

  • The LynPlexS character set
  • LynPlexS keywords
  • the general structure of a LynPlexS program
  • that LynPlexS statements may end in a ;
  • that LynPlexS is a free format language
  • LynPlexS programs may use header files that contain standard library functions.

LynPlexS Character Set:

LynPlexS does not use, nor requires the use of, every character found on a modern computer keyboard. The only characters required by the LynPlexS Programming Language are as follows:

   A - Z 
   a -z 
   0 - 9 
   space . , : ; ' $ " 
   # % & ! _ {} [] () < > | 
   + - / * = 

The form of a LynPlexS Program:

A LynPlexS program may consist of a few lines of code or it may be a large program that consists of multiple functions. The prolog code can be the main function or the main function can be declared as such.

For more advanced programs the main function will act as a controlling function calling other functions in their turn to do the dirty work! The main function is the first function that is called when your program executes.

LynPlexS makes use of keywords which combine with the formal syntax to the form the LynPlexS programming language. Note that keywords may be written in lower case, upper case or mixed case.

A keyword may be used for other purposes. Note that LynPlexS does not support all options at present.

The layout of LynPlexS Programs:

The general form of a LynPlexS program is as follows (don't worry about what everything means at the moment - things will be explained later):

global declarations
prolog code
function main()
 local variables to function main ;
 statements associated with function main ;
 end function //main()
function f1() 
 local variables to function 1 ;
 statements associated with function 1 ;
 end function //f1() 
function f2() 
 local variables to function f2 ;
 statements associated with function 2 ;
 end function //f2() 
.
.
.
etc

Also note the semicolon - yes it is there, but you might have missed it! A semicolon (;) can be used to terminate LynPlexS statements, but it is only necessary to separate multiple statements on the same line. Statements normally end at the end of a line.

LynPlexS is a free format language and long statements can be continued onto the next line. Any special character or operator at the end of a line is treated as a continuation. Free format also means that you can add as many spaces as you like to improve the look of your programs.

Preprocessor Directives:

LynPlexS does not currently have a preprocessor.

LynPlexS is a small language but provides the programmer with all the tools to be able to write powerful programs. Some people don't like LynPlexS because it is too primitive! Look again at the set of keywords that comprises the LynPlexS language and see if you can find a command that allows you to print to the computer's screen the result of, say, a simple calculation. Don't look too hard because it doesn't exist.

It would be very tedious, for all of us, if every time we wanted to communicate with the computer we all had to write our own output functions. Fortunately, we do not have to. LynPlexS uses libraries of standard functions which are included when we build our programs. For the novice LynPlexS programmer one of the many questions always asked is does a function already exist for what I want to do? Only experience will help here but we do include a function listing as part of this course.

I have already mentioned that LynPlexS is a free format language and that you can layout your programs how you want to using as much white space as you like. The only exception are statements associated with the preprocessor.

Continue

That's enough background to LynPlexS programs - lets get on with our first program which will start to bring together some of the ideas outlined above.


lynplexs/tutorial/c03.txt · Last modified: 2014/05/25 18:39 (external edit)