Markpro Hybrid Language

Markpro      Hybrid Language


Changing syntax of programming languages

1. Reversed assignment operator  a + b -> a

Allows assignment to flow from left to right like we write

in more natural direction

2. Tagging keywords  {while} ... {/while}

This allows to easy introduce new keywords into language

and to easy find mistakes in control flow of programs

It offer flexibility of markup languages and rigor of programming ones

3. Reversed function declaration  {fun} int a, b -> f int  and  call  a, b -> f
 
These changes allow to seamlessly combine input and output in one line



Code Example of Markpro language with new syntax


Functions

{meta} Euclidian ! module header

    {invoke} -in2out- {/invoke} 

            !using built-in input/output module

    {fun} int a, int b -> Euclid int {/fun}    

            !fun declaration only

{/meta}        !header file extensions .meta
         

{module} Euclidean         ! module itself

     {invoke} "Euclidian.meta" {/invoke}  

                     !calling header if it is in another file

     {fun} int a, int b -> Euclid int  ! function with type int
                            
          {while} b!= 0
              {if} a > b
                 a - b -> a
              {else}
                 b - a -> b
              {/else}
              {/if}
          {/while}

          {return} a {/return}

    {/fun}

 
  {fun}    string args[] -> main int        ! main function

         int a, b

         in -> a, b -> Euclid -> out

        ! combined input and output and function call

        ! here is introduced streamlined logic and
    
        ! seamless input to output syntax

  {/fun}

{/module} ! module file extension .mpl


File System

f -> (name, type, options)    ! file definition

f -> open    

f -> close

f -> var    ! read from file

var -> f    ! write to file


Concurrent Functions

{cofun} int a, b -> f1  int...    ! function declaration
            . . .
{cofun} int c, d -> f2  int...

{cofun} int g, h -> f3  int...

! run in parallel

a1 b1 -> f1 || c1 d1 -> f2 || g1 h1 -> f3


Dynamic Function

Dynamic function is function that can take

another function as a parameter

Declaration

{fun} int a1, int b1 -> f1 int ...

{fun} int a2, int b2 -> f2 int ...

{fun} int f1, int f2 -> f int dynamic ...

or

{fun} fun f1, fun f2 -> f fun ...    ! fun is a type here

Call

f1 , f2 -> f


Implementation

This is a general purpose language

It should have written in Rust compiler  

This way it will be fast and secure

Comments

Popular posts from this blog

Hybrid Markup Language

Stream - Syntax-Oriented Language

iTeraTor Universal Data Language