BlackBat wrote: |
---|
"Mr.Framework, can you tell us about your programming language more?!" |
Sure. Here's a quick overview:
•
16/32/64-bit Assembly Support. The assembly instructions are integrated, and support procedures. Unlike C/C++, in-line assembly doesn't appear in a function call, nor does it appear as a string. Here's an example:
x86.mov ax, $0x01; comment.
The
x86 prefix means the compiler will use 32-bit registers. The
$ indicates the beginning of a constant (hexadecimal only). Constants that begin with
0x are considered addresses.
•
Modules. Modules are similar to C++'s name-spaces. Modules provide a new scope in which declarations can be placed. Modules work like C++'s name-spaces, and take this form:
1 2 3 4 5 6 7 8
|
module my_module
{
; Functions:
void function();
}
; Accessing a module:
my_module.function(); call "function" from within "module."
|
However, unlike C++'s name-spaces, modules work in conjunction with header files. When you include a header into another file, you can specify what the pre-processor imports from the header file. For example:
1 2 3
|
$import module: header.cogh
$import module.nested_module: header.cogh
$import module.function: header.cogh
|
The first line can be read as:
import "module" from "header.cogh." The second line can be also read as:
import "nested_module" from within "module" in "header.cogh." Finally, the third line can be read as:
import "function", and all of its overloads, from within "header.cogh." The advantage to this is that you only import what you want, and not import heaps of code that you don't want.
•
Threading. With today's demands for performance, threading is an essential feature of any language.
Threads are also integrated into the language, and are placed within the
kernel module. The design for this is not yet implemented.
•
Classes. Classes are fully customisable. You can apply different
attributes that change the way the compiler handles the class. Here's a simple class declaration:
1 2 3 4 5 6
|
class my_class(align(4), explicit)
{
; Class members
constructor(...);
destructor(...);
}
|
The code after
my_class are the attributes. From left to right, the first attribute means this class must be aligned on a 4-byte boundary. The second attribute specifies that the compiler must not do anything implicit. In other words, the programmer must be explicit as to what he/she wants to be defined within the class. For example, if a programmer wants a constructor and/or destructor, they must specify one.
I haven't decided whether or not the language supports OOP.
•
User-defined types. This feature is mainly for efficiency purposes. A programmer can define a new type, such as an integral type, character type, or floating-point type, whilst being able to define the amount of bytes (1, 2, 4, 8, 16, ...) the type should allocate. Of course, the amount of bytes depends on the host's architecture. Here's the syntax:
typedef my_type, s_int:2; Type-definition.
This can be read as:
define "my_type" as an signed integral type, which allocates 2 bytes.
That's a few features, but I'm far from done :)
Wazzak