articulo vargas
TRANSCRIPT
8/2/2019 Articulo Vargas
http://slidepdf.com/reader/full/articulo-vargas 1/3
º
Abstract —The preceding paper “A Simple Overview about
Pascal FC” emphases in a student’s first vision of the history,theory and vision of the concurrent programming, the behavior
and the features that are special in this type of paradigm andappreciate the matter of this kind of languages using the
research, correct information sources and the auto knowledge.In the other hand, also can discuss and express an opinion todemonstrate to a College student why is important know the
existence of the Concurrency.
I. I NTRODUCTION
HE TASK OF PROGRAMMING CONCURRENT SYSTEMS IS
SUBSTANTIALLY MORE DIFFICULT THAN THE TASK OF PROGRAMMING
SEQUENTIAL SYSTEMS,. I N THIS PAPER WE DESCRIBE A PROGRAMMING
LANGUAGE THAT ALLOWS COMPREHENDING THE STRUCTURE OF THE
CONCURRENT LOGIC. AND ON THE OTHER HAND, PROVIDES A
DECLARATIVE SPECIFICATION OF THE SYSTEM CONCURRENCY ISSUES.
THIS PROVIDE GREAT ADVANTAGES IN WRITING CONCURRENT PROGRAMS
AND MANIPULATING THEM WHILE PRESERVING
T
II.PROCEDURE FOR PAPER SUBMISSION
A. Review Stage
Pascal-FC is an extension of one of Wirth's simple Pascal’s.
The added features allow processes to be specified and
executed concurrently. The language is used to give computer
science students practical experience of a range of concurrency
models.
A common way of introducing programming to novices is by
the preparation of a recipe or algorithm for some simple human
activity, such as taking a shower, or does the dishes. In such
introductions the aim is usually to stress the idea of sequential
algorithms, where "one thing gets done at a time".
Although this approach is probably familiar by now to most
readers, on reflection it may be seen as a little tenacious to try
to twist all problems solving into this mould - indeed, that may
be the very reason why some beginners find the sequentialalgorithm a difficult concept to grasp. Many human activities
are better represented as a set of interacting processes, which
are carried out in parallel. In the next step of this paper we go
to describe the program structure, data type and the syntax of
the language
II.STRUCTURE
First of all come the program header. This must contain the
keyword program followed by the name of the program. It
should also contain a comment giving an overview of what the
program does.
Program ejemplo;
The next section is the declaration section. Here you declare
user-defined types, processes, global variables and constants.
You can include these in any order, subject to the condition that
you cannot refer to a type until it has been declared. Here we
declare a constant, two user-defined types, three processes, auser-defined process type, and finally some variables ( including
some that use the user-defined types).
var num1, num2 : integer;
Then, The final section is the main program block. It begins
with the keyword begin, and ends with the keyword end
followed by a full-stop ("."). Execution of the program starts
with the first statement after the begin in the main program
block. You can include at most one cobegin-coend block inside
the main program block. This contains a number of processes
that are to be started up concurrently. The cobegin-coend block
finishes executing when all the processes that it started havefinished.
begin
writeln('===================================');
writeln;
cobegin;
{ Connect the beginning of the pipeline to the generator. }
numbers(pipeline[0]);
{ Connect the end of the pipeline to the sink. }
consumer(pipeline[kNumberOfPrimes]);
{ Connect the filters to the pipeline. }
for index := 1 to kNumberOfPrimes do
begin
filters[index](pipeline[index-1], pipeline[index],
output[index]);
end;
{ Connect the output process to the array of results. }
outproc(output);
coend;
A Simple overview about PASCAL FC (January2012)
C. Vargas, Student , ECI
1
8/2/2019 Articulo Vargas
http://slidepdf.com/reader/full/articulo-vargas 2/3
º
end.
Functions and Subroutines
Pascal distinguishes between subroutines that return a result
and subroutines that don't. Subroutines that return a result are
called functions, and subroutines that don't are called
procedures. Functions and procedures are declared in thedeclaration section of the program, and can be nested. Nested
functions and procedures are only visible to the subroutine
which contains them.
Arguments to subroutines are declared in a similar way to
variables: the variable name, then a colon, then the type of the
variable.
x : integer; finished : Boolean
Functions
Functions must return a value. This is done by assigning thereturn value to the function's name:
function resta(var a,b:integer):integer;
begin
resta:=a-b;
end;
Procedures
Procedures are similar to functions, the difference being that
they cannot have an explicit return value:
procedure leer(var vec : vector);
var
cont:integer;
begin
for cont:=0 to 5 do
begin
write('escriba el numero ');
readln(vec[cont]);
end;
end;Variable Parameters
Both functions and procedures can have variable parameters. Normally if you attempt to change the value of a parameter
inside a procedure or function, the changes are not visible
outside the subroutine. (Technically, this is because the
procedure receives a copy of the parameter that behaves like a
local variable, except that it is initialized to the value of the
actual parameter.)
procedure TryToChange(x : integer);
begin
x := 7;
end;
{ of procedure TryToChange }
var
a : integer;
b : integer;
begin
a := 3;
TryToChange(a);
writeln('a has the value: ', a); { a is still 3. }
end.
{ of main program block }
If you want a procedure or function to be able to change the
value of a parameter, you can make it a variable parameter by
including the keyword var in the procedure declaration:
procedure TryToChange2( var x : integer);
begin
x := 7;end;
{ of procedure TryToChange2 }
var
a : integer;
b : integer;
begin
a := 3;
TryToChange2(a);
writeln('a has the value: ', a); { a is now 7. }
end.
{ of main program block }
III. EXAMPLE
In this section, I go to show an example of a simple exercise
proposed in class to comprehend the structure in a sequential
point of view.
program menorVec;
type vector = array[0..5] of real;
var vec:vector;
cont:integer;
menor:real;
begin
for cont:=0 to 5 do
begin
write (‘Digite el número: ’);
readln(vec[cont]);
end;
2
8/2/2019 Articulo Vargas
http://slidepdf.com/reader/full/articulo-vargas 3/3
º
menor:=vec[0];
for cont:=1 to 5 do
begin
if (menor > vec[cont]) then
begin
menor:=vec[cont];
end
end;
write('el menor del vector es ',menor:10:2);
end.
IV. CONCLUSION
A conclusion section is not required. Although a conclusion
may review the main points of the paper, do not replicate the
abstract as the conclusion. A conclusion might elaborate on the
importance of the work or suggest applications and extensions.
R EFERENCES
[1] http://www-ist.massey.ac.nz/csnotes/355/pascalfc/
[2] http://comjnl.oxfordjournals.org/content/33/2/147.full.pdf [3] http://jcoppens.com/soft/pfc2/prog/pascal-fc_lrm.pdf Pascal
FC 5 Reference Manual GuideManual Reference Guide
3