Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Æ Programming Language.

Name: Anonymous 2007-12-20 22:59

Programming language design.
Temporary name: Æ

0: Comments

# Comment
// Comment
/* Comment */
#include <stdio.Æh> // Preprocessor, include normal function such as print, etc.
// Code layout is similar to haskell. Code here includes {, }, and ; for no reason.


1: Real Variable

Can only be integer pointers.
Starts with a character or underline, can continue with everything among [a-zA-Z0-9_æøåäöüëâôûêáóúéàòùèçþ®ßðЪºetc.], generally no line-noise except _.
Are defined as this:
  global_variable = 3905671;

2: Variables

Starts with $. Creates a real variable with the variable name specified prefixed with v_.
The name can contain everything a real variable can continue with.
Data types are per default whatever you use them as.

$var = "Hello there.";    // v_var == <location to 'db "Hello there.", 00h' in memory>
$var = 19;        // v_var == <Location to where 19 is stored in memory>;
$var = (19, "Hullo");    // A linked list, v_var is a pointer to the first element, or something like that.
$var = [19, 2 => 20];    // An associative array.
$var = { ++$i; }    // Compiled machine code.
// and so on.

v_var2 = v_var;
$var2 = "sadf"; // $var == "sadf";

$var1 = "lulz";
$var2 = $var1;
$var2 = "Hey"; // $var1 == "lulz"


3: Keywords:

Starts with a %.
Is not a real variable.


%if ($i == u) {
    // Code
} %elseif (%isset $whatever) {
    // code
} %else {
    // Code
};

Generally the same with %do, %while, %goto, %foreach, %static, etc. as with other languages.
%private for a variable or label that should be inaccessible to the outside.

4: Functions

Starts with !. Creates a real variable with the function name prefixed by f_. The name can contain the same as variable. f_functionName is a pointer to where the function is defined in memory. If you give it an argument a variable local to that function named v_1 will point to the location in memory where the argument existed. You can rename the variables by defining the function as !func($var_1, $var_2, $_etc).


!function = {
    !print $1;
    %return;
}
%void !func($string) = {
    !print $string;
    !print "The second variable is contains: " ++ $2 ++ " and is located at " ++ !i2s v_2 ++ "\n"
    %return;
}
%string !i2s(%int $int) {
    // Code for converting an integer into a character array
    %return $string;
}
%int !main = {
    !function "Hello, world!\n";
    !func "Hello again, world!\n", "lulz";
    %return 0;
}


5: Labels

Generally just the same as functions.

!func(%int $i) = {
    !label = {
        !print i2s($i) ++ "\n"
    }
    --$i;
    %if ($i != 0) {
        %goto f_label;
    }
    %return;
}
!main = { !func 10; %return; }


6: Variable searching order.

When attempting to access the variables it first searches local real variables, local variables, global real variables, and global variables in that order. Same with functions.

//You can access the above function as a string of bytecode thusly:
!print !escape $f_func;

//The first line of it:
!print !escape $f_func[0];

//The contents of the label !label:
!print !escape $f_func[label];

//First line of !label:
!print !escape $f_func[label][0];

You can also execute !label directly with !func.!label, but this would have resulted in an error because $i wouldn't have existed.


Etc.

7: Self-modifying code.

$f_func[0] could refer either to the first line, or if the first line is a code block
(as delimited by { and } when not using code layout to controll them), the whole first block
(from which you can select individual lines from again with $f_func[0][0])

Example:
Replace the !main function in the example in section 5 with this:

!main = {
    !func 2;
    $f_func[1] = { ++$i; }
    !func -2;
}


Should print:
2
1
-2
-1


8: Misc.

!main = {
    !multithread f_func1 f_func2;
    // Inline functions:
    $result = !{$1 = "<b>" ++ $1 ++ "</b>"; return $1; } "Useless...";
}


9: And so?

A) Expand with objects, quajects, inline-assembly, superoptimizing compilers, a ton of libraries, etc.
B) Write kernel that uses live code synthesis for lightspeed performance.
C) Be hailed as the person who freed computers from their prevoius speed limits.
D) Watch as a self-modifying AI takes over and destroys the world.
E) ???
Æ) Profit!

10:
Influences: C, Assembly, Perl, Haskell
Explaination for potential suckage: I'm 18 years old and have absolutely no education.

11:
Discuss.

Name: Anonymous 2007-12-20 23:50

>>3 It is a way to substitute old for new. Everything exists as a variable, a pointer, a function, and a label at the same time, and the prefix is the way you want to access it.
Yes, it's a silly and extraordinarily limited way to substitute old for new. As I understand it (your example is unclear) this would provide a way to refer back to some named "entity" (and you need to define the meaning of "exists" more clearly) and modify it slightly.

a. This introduces an over-reliance on named temporary variables and one function per line style, both of which are hugely problematic.

b. The number of situations in which you want to modify just one small element of a procedure is vanishingly small. Normally this either breaks code or leaves you with unused code elsewhere in the procedure.

c. You can do the same thing and much more just by editing the procedure definition and replacing the whole thing.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List