P-Lingua format

From The P-Lingua Website

(Difference between revisions)
Jump to: navigation, search
(Replacing page with 'under construction...')
Line 1: Line 1:
-
== Valid identifiers ==
+
under construction...
-
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:
+
-
 
+
-
* [[#Global variables definition | Global variables]]
+
-
* [[#Local variables definition | Local variables]]
+
-
* [[#Indexes and parameters | Indexes]]
+
-
* [[#Indexes and parameters | Parameters]]
+
-
 
+
-
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 | 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 | parametric sentences]] and [[#Modules definition | modules definition]] respectively.
+
-
 
+
-
== Identifiers for electrical charges ==
+
-
 
+
-
In P-Lingua, we can consider electrical charges by using the '''+''' and '''-''' symbols for positive and negative charges respectively, and no one for neutral charge. It is worth mentioning that polarizationless P systems are included.
+
-
 
+
-
== Membrane labels ==
+
-
 
+
-
There are three ways of writing membrane labels in P-Lingua: the first one is just a natural number; the second one is to denote the label as a valid identifier and the third one is by numeric expressions that represent natural numbers between brackets.
+
-
 
+
-
== Environment identifiers ==
+
-
 
+
-
For multienvironment P systems, there are three ways of writing environment identifiers in P-Lingua: the first one is just a natural number; the second one is to denote the label as a valid identifier and the third one is by numeric expressions that represent natural numbers between brackets.
+
-
 
+
-
== Numeric expressions ==
+
-
 
+
-
Numeric expressions can be written by using '''*''' (multiplication), '''/''' (division), '''%''' (module), '''+''' (addition), '''-''' (subtraction), '''^''' (potence), '''@floor''' (the next smaller integer), '''@ceil''' (the next largest integer) and '''@log''' (base 2 logarithm) operators with integer or real numbers and/or variables, along with the use of parentheses. It is possible to write numbers by using exponential notation.
+
-
 
+
-
Examples of numeric expressions:
+
-
* <m>$3*10^{-5}$</m> is written '''3e-5'''.
+
-
* <m>\frac{3^{4-x}+17}{23}</m> is written '''(3^(4-x)+17)/23'''.
+
-
* <m>7\lceil log_2 x \rceil</m> is written '''7* (@ceil @log x)'''.
+
-
 
+
-
 
+
-
== Objects ==
+
-
The objects of the alphabet of a P system are written using valid identifiers, and the inclusion of sub-indexes is permitted by using brackets. For example, <m>$x_{i,2n+1}$</m> and ''Yes'' are written as '''x{i,2*n+1}''' and '''Yes''' respectively.
+
-
 
+
-
The multiplicity of an object is represented by using the '''*''' operator. For example, <m>$x_i^{2n+1}$</m> is written as '''x{i}*(2*n+1)'''.
+

Revision as of 10:12, 4 April 2010

under construction...

Personal tools