Tangerine Quantum AI 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
3. Reversed object notation b@agi instead of agi.b
4. Reversed function declaration {fun} int a, b -> f int and call a, b -> f
These two changes allow to combine input and output in one line
which is also more natural
5. New for loop syntax {for} 0 -> i++ < n
Pseudo Code Examples
Classes and Functions
{module} Euclid ! comment
{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} main int ! main function
int a, b
in -> a , b -> euclid -> out
! combined input and output and function call
{/fun}
{/module}
Loops and Functions
{module} primes
{fun} int n -> Eratosthenes ! subroutine declaration no type
primes [ n ], 1 -> l ! assignment operator
0 -> i, 3 -> index_square ! proc sift
first, last, factor ! proc mark sieve
{for} 0 -> k++ < n ! fill with true, new loop syntax
true -> primes[k]
{/for}
{while} index_square < n !proc sift
{if} primes[i] !proc mark sieve
0 + index_square -> first
0 + n -> last
i + i + 3 -> factor
false -> primes[first]
{while} last - first > factor
first + factor -> first
false -> primes[first]
{/while}
{/if} ! proc mark sieve
i + 1 -> i
2 * i * (i + 3) + 3 -> index_square
{/while} ! proc sift
' 2' -> out ! print out
{for} 0 -> i++ < n ! print out, new loop syntax
{if} primes[i]
{if} 2 * i + 3 > n
break
{/if}
' ' 2 * i + 3 -> out
l + 1 -> l
{if} l % 10 == 0
'\n' -> out
{/if}
{/if} ! if
{/for} ! print out
'\n number : ' l -> out
{/fun} ! erato fun
{fun} main int ! main function
1000 -> Eratosthenes ! subroutine call
{/fun}
{/module}
File System
f -> (name, type, options) file definition
f -> open
f -> close
f -> var read from file
var -> f write to file
Concurrent Function
{cofun} int a, b -> f1 int ! function declaration
. . .
{/cofun}
{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 ...
Call
f1 , f2 -> f
Implementation
This pseudo code could be implemented
as a statically typed language written in Rust
as a compiler to bytecode that can be
interpreted then by JVM
Comments
Post a Comment