P-Lingua format

From The P-Lingua Website

(Difference between revisions)
Jump to: navigation, search
Line 14: Line 14:
Four kind of variables are permitted in P-Lingua:
Four kind of variables are permitted in P-Lingua:
-
* Global variables
+
* [[#Global variables definition | Global variables]]
-
* Local variables
+
* [[#Local variables definition | Local variables]]
-
* Indexes
+
* [[#Indexes and parameters | Indexes]]
* [[#Indexes and parameters | Parameters]]
* [[#Indexes and parameters | Parameters]]
Line 22: Line 22:
===Global variables definition===
===Global variables definition===
-
Global variables must be declared out of any program module and they can be accessed from all of the program modules (see ref{subsec:modules_definition}). The name of a global variable '''global_variable_name''' must be a valid identifier. The syntax to define a global variable is the following:
+
Global variables must be declared out of any program module and they can be accessed from all of the program modules (see [[#Modules definition | modules definition]]). The name of a global variable '''global_variable_name''' must be a valid identifier. The syntax to define a global variable is the following:
  global_variable_name = numeric_expression;
  global_variable_name = numeric_expression;
Line 35: Line 35:
=== Indexes and parameters ===
=== Indexes and parameters ===
-
Indexes and parameters can be consider local variables used in \ref{subsec:parametric_sentences} and \ref{subsec:modules_definition} respectively.
+
Indexes and parameters can be consider local variables used in [[#Parametric sentences | parametric sentences]] and [[#Modules definition | modules definition]] respectively.

Revision as of 09:48, 4 April 2010

Contents

Valid identifiers

We say that a sequence of characters forms a valid identifier if it does not begin with a numeric character and it is composed by characters from the following:

a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 _

Valid identifiers are widely used in the language: to define module names, parameters, indexes, membrane labels, alphabet objects and strings.

The following text strings are reserved words in the language: def, call, @mu, @ms, @model, @lambda, @d, let, @inf, @debug, main, -->, # and they cannot be used as valid identifiers.

Variables

Four kind of variables are permitted in P-Lingua:

Variables are used to store numeric values and their names are valid identifiers. We use 64 bits (signed) in double precision.

Global variables definition

Global variables must be declared out of any program module and they can be accessed from all of the program modules (see modules definition). The name of a global variable global_variable_name must be a valid identifier. The syntax to define a global variable is the following:

global_variable_name = numeric_expression;

Local variables definition

Local variables can only be accessed from the module in which they were declared and they must only be defined inside module definitions. The name of a local variable local_variable_name must be a valid identifier. The syntax to define a local variable is the following:

let local_variable_name = numeric_expression;

Indexes and parameters

Indexes and parameters can be consider local variables used in parametric sentences and modules definition respectively.

Personal tools