3GL   4GL   5GL   .

-

" ", "- " " ". () . " ".

:

= ,
= , , if, for while
- = , ()
= , , , — ;
() = " => "
= " => "
= " => " +
=

2x2

2x2:

\
 
 

(.. , " ") () .

. , , . , "" . , .

, , .

, , , . , .

, , , , .

— , , .

: , , , ( ) .

, , .

, : , — .

, . , . "" , "" . .

: — , , . . .

. "". , .

:
(flow)
(global) , ,
(local) ( )
(event)

, , , , , ( ).

:
() (n- ) ( -> )
( , ) ( -> )

- () ( ). . ( ).

, - ():

— (!) .

() , , , SMS , SMS .

= x

, - , ( , ) . .

, . , , , , .., , .

, .

, . ( , ). , , ( , SMS ).

. .

- .

, .

" ", , , , , , .

. (, , ), () , (, ) ( ).

: , . , .

.

.

, .

— "". . - ().

Procedure _ 
begin
    ;
    ;
      ;
     ;
    5 ;
end
begin
   if    then
         ;
   _;
end.

, , — , .

, (prerequisites) . .

(postrequisites), , - .

.

, .

?
. , , .

?
. 1975 : , go to.

. . — , — . ( - — ), . .

- , .

-

- — . . - , . , . .

. -- , . - , , , — .

— .

, . ( ) :

class  {
     ? () 
   
      ();
   
     ();
   
      (, );
}

   , , :

class  {
   // boolean
     ();    

   // boolean
     ();  
   
   //  boolean (  )
     (, );  
}

, - .

, , -- , "" " ". , , .

:

, - .

. , 5 — , , "". .

- : , , , (graphical user interface controls) — , . , , ().

, - . , , .

- C++.

— — (push) (pop). , ( — First In First Out (FIFO)).

// File: stack.cpp
class Stack {
   int *m_data;
   int m_size;
   int m_pt;
public:
   Stack(int size) {
      m_size = size;
      m_data = (int*)malloc(m_size * sizeof(int));
      m_pt = 0;
   };
   ~Stack() {
      free(m_data);
   };
   int pop(void) {
      if(m_pt)
         return m_data[--m_pt];
      else
         return 0;
   };
   void push(int a) {
      if(m_pt >= m_size-1) {
         m_size = 10 + 2 * m_size;
         m_data = (int*) realloc (m_data, m_size * sizeof(int));
      }
      m_data[m_pt++] = a;
   };
   int empty() {
      return (m_pt == 0);
   }
};

, — , . "" , . pop() , , , (realloc) . , , ~Stack() , .

Stack . , m_pt [0, m_size).

, — , , , . .

, - :

, , . , , . , .

, , , , , , . . , .

C vs C++

, .

class  {
     ();
     ();
     ? ();
      ();       //  +     ?
       (, , );
        (); //  
}
class  {
     ? ();
     ();
     ();
      (, );
       (, );
}
class  {
     ?();    
     ?();   
     ();           // +   ?
     (,  );  
       (, );
}

- — , "!", .

, .

: - " -> (, )"?

.

__     ( < > );
__    (, < > );
__     (,  < > );
__   (, , );
__ (, , );
__  (, , , );

___ (, ); //  ,  ,  .
___   (, );  //   ,   .

- C++ . "", , "". , .

. (, , , , ..., — , ) . , , , . . - . . "" , . — , .

- , (, , ). , .

, . . . - . , , .

, , . "".

, , 0, , errno — . :

__(errno); //    

, ++ Java, , . . , — .

, , . — . , , , — , .

— . - .

C++ ( )

() , , , . ,

    5 6 *                     -->   5 * 6
   (5 6 *)  (2 3 *) +         -->   (5 * 6) + (2 * 3)
    1 2 3 4 5 * + - /         -->   1  / (2 - (3 + (4 * 5)))

. ,


.

- . , , (a = pop(), b = pop()), (push(a * b)).

, class Stack, .

#include <stdio.h>
#include <malloc.h>
#include <stack.h>

int
main() {
   class Stack s(100);
   int i;
   while(!feof(stdin)) {
      int c = getchar();
      int x;
      switch (c) {
         case EOF: break;
         case ' ': break;
         case '\n': printf("Result = %d\n", s.pop()); break;
         case '+': s.push( s.pop() + s.pop() ); break;
         case '-': s.push(-s.pop() + s.pop() ); break;
         case '*': s.push( s.pop() * s.pop() ); break;
         default:
            ungetc(c, stdin);
            if(scanf("%d", &x) != 1) {
               fprintf(stderr, "Can't read integer\n");
               return -1;
            } else {
               s.push(x);
            }
            break;
      }
   }
   RESULT:
   i = 0;
   while(!s.empty()){
      printf("Result%d = %d\n", i,  s.pop());
      i++;
   }
}

, - .

, while — , --- - .

, . . ( EOF).

, "" — pop push.

, ( , ) - .

Perl:

$_ = <>;
print eval $_;

Perl,

Perl, .

$_ = <>; chomp;
sub mul($$)   { return $1*$2;}
sub sum($$)   { return $1+$2;}
sub minus($$) { return $1-$2;}
while(
   s/(\d+)\s*[*]\s*(\d+)/mul($1,$2)/e ||
   s/(\d+)\s*[+]\s*(\d+)/sum($1,$2)/e   ||
   s/(\d+)\s*[-]\s*(\d+)/minus($1,$2)/e ||
   s/\(\s*(\d+)\s*\)/$1/e
   ) { print "$_\n";};
print "Result=$_\n";

3*(4+5)+2
3*(9)+2
3*9+2
27+2
29
Result=29

, :

C , , . . , . , .

:

(1*2)+3*(4+5)
(2)+3*(4+5)
(2)+3*(9)
2+3*(9)
5*(9)
5*9
45
Result=45

. .

, . Perl , , , .

. , LaTeX HTML :

 1
  \begin{center} <,    begin{center}>  \end{center} 
      
  <center>  <  > </center>

 2
  \section{     } 
      
  <h2>  <  > </h2>

 3
    ~   &nbsp;

....

, , , ( ) -- . . .

, "" LaTeX HTML "&nbsp;" , ( ) " ". Perl - .

.

( ), .

, ( , , ).

\
transition_act dequeued token from global_queue changed global_state make transition (atom) none, {events}, {enqueue tokens to global_queues of other automats} Libraries:
automats
definition flow flow calculate calculate others (composite) Libraries:
functions
procedure flow,{global} flow,{global} execute execute others (composite) Libraries:
procedures
transform rule (pattern->transform action) global global query query subqueries Libraries:
transformation rules
inference rule (logical condition->new fact) global global query query subqueries Libraries:
inference rules + facts

\
Assembler action_simple(Global:restricted) + data_simple Global:(named+addressed)_simple+FIFO Procedures:Local+Global Libraries:
Functions
action_macro(Flow+{Global}) + data_simple (Global + Local):(named+addressed)_simple+Flow Procedures:Local+Global Libraries:
Functions
Prolog Rule+Fact+Query Global:[d]named_relations Rules:Global Libraries:
(Rules+Facts)
Haskell Function(Flow) Flow Functions:Global Libraries:
Functions
Tcl Function(Flow+Global) (Global+Local):[d]named_structures Functions Namespace:
(Functions+Objects)
Java Class() (Global+Local):named_(simple+dobjects) Functions Namespace:
(Functions+Classes+Objects)

. , ( ) .

, .

Tcl, Perl, ... . , ++. Java, Pascal — . .

Prolog — n- . , ( ). , Prolog .

, ( , , , A, ...).

C, Pascal, Java, Ruby, ... — .

Perl, Python, — () . -- , -, , . , .

SQL — , ( ).

, , .

Ruby, , , 232, ( , ) FixedInteger BigInteger.

, , .

, , .

, Perl , , (->) — - . , , .

, , , .

, , .

, .

, .

        3GL   4GL   5GL   .

, Polymorphism, - - , .




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution