Click here to Skip to main content
Click here to Skip to main content

Bird Programming Language: Part 1

By , 1 Jan 2013
 

Articles About Bird

Table of Contents 

Introduction

I'm developing this language because I don't find the other languages perfect for everything. C++ is known to be one of the fastest languages, but its syntax (especially header files) and the lack of C# like high level features makes developing slower in my opinion. Debugging can be also hard in C++. But C# is a managed language and it limits low level programming and application performance. 3D graphics is about 1.5-2 times slower in C# than in C++.

I have been working on Bird since March 2010 in C#. It's a strongly typed native language. Its performanceeseems to be competitive with C++ compilers currently and it's going toand it's going to have features from high level languages besides new things. There are many things that I haven't implemented yet, but it can be used for smaller programs. The syntax is similar to C# and C++ with some modification in order to make code smaller and improve readability. I was planning to make a C# parser too, but I stopped working on it for now. I will start working on a new in the future. The libraries are similar to .NET, the basic functions are going to be implemented. So I think it won't be hard to understand.

Requirements for Running a Program

Samples have a C++ equivalent code to compare performance. In order to compile them MinGW, Clang are needed to be installed and set in the PATH variable, but it's optional. Visual C++ compiler usage requires the path to "vcvarsall.bat" in to be set in "Run - VC++.bat" files.

Creating Programs with Bird

The compiler can be run from command line by "Bird.exe" which is in the "Binaries" directory:

Bird.exe -x -nodefaultlib -lBirdCore -entry Namespace.Main Something.bird -out Something.exe

I've made .bat files for the samples, so using command line for them is not needed. The -x means that the compiler should run the output file after it had been compiled. The input files can be Bird files, C, C++ or Object files.

Libraries can be specified by the -l option. Currently the BirdCore and BlitzMax are available that are included by default. The -nodefaultlib disables them. BlitzMax is another programming language, its functions are needed for graphics because I haven't implemented them yet.

Object and archive files also can be the output file to use it in other languages. It can be specified with the -format attribute. These are its possible values:

app Executable file
arc Archive file, it doesn't contain the libraries, they need to be linked to the exe.
obj Object file, only contains the .bird files' assembly. The other files and libraries are not included.

Syntax

A Simple Function

using System

void Main()
    Console.Write "Enter a number: "
    var Number = Convert.ToInt32(Console.ReadLine())
    if Number == 0: Console.WriteLine "The number is zero"
    else if Number > 0: Console.WriteLine "The number is positive"
    else Console.WriteLine "The number is negative"
    
    for var i in 1 ... 9
        Console.WriteLine "{0} * {1} = {2}", i, Number, i * Number

    Console.WriteLine "End of the program"

The indication of code blocks are done based on the whitespaces in front of lines. One scope always have the same number of whitespaces. Colon can be used to make the command able to have the inner block in the same line. The compiler needs to know where the previous expression ends. If there's no expression, like the else statement without if, the colon is not needed.

Functions can be called without brackets, if the returned value is not used. In the for loop the var keyword means the type of i, which is the same as the initial value (1 -> int). The three dots means that the first value of i is 1, and it includes the value at the right side, so the last value is 9.

I was thinking about making able to declare variable without type (or the var keyword), but it could lead to bugs if the name of the variable is misspelled.

Literals

Number literals can have different radix and type. $ means hexadecimal, % means binary. Hexadecimal letters have to be uppercase to distinguish them from the type notation, which is the lowercase short form of the type at the end of number:

$FFb        // An unsigned byte
-$1Asb      // A signed byte
%100        // A binary number

Chained Comparison Operators

I think that this could have been implemented in C languages, because in some cases it can be useful. Each sub-expression runs only once, so it's also faster that making two relation connected with and.

bool IsMouseOver(int x, y, w, h)
    return x <= MouseX() < x + w and y <= MouseY() < y + h

The relation operators can only face to one direction to make them distinguishable from generic parameters.

Aliases

It's similar to the using alias directive in C# and the typedef keyword of C++, but in Bird aliases can be created for everything, even for variables. The order of declaration doesn't matter, so it's possible to do this:

alias int32 = int
alias int64 = long
alias varalias = variable

int64 variable

Tuples

Tuple Basics

Tuples are similar to structs but they don't have name. Unlike .NET tuple, Bird tuples are value types. Tuples are a grouping of named or unnamed values that can have different types. For example:

var a = (1, 2)            // Type: (int, int)
var b = (1, 2f)           // Type: (int, float)
var c = ("Something", 10) // Type: (string, int)

In this case the reference of members are done by the index of it (e.g. a_tuple.0), but they can get a name:

alias vec2 = (float x, y)

const var v = (2, 3 to vec2
const var vx = v.x
const var vy = v.y

These variables can be declared as constant because the compiler interprets (2, 3) as a single constant.

Tuples can be also used to swap the values of variables:

a, b = b, a

Tuples as Vectors

Vector operations are based on tuples. The SSE/SSE2 packed instructions will be emitted by tuple operations instead of vectorization. The Cross function can be written as:

alias float3 = (float x, y, z)

float3 Cross(float3 a, b)
    return a.y * b.z - a.z * b.y,
           a.z * b.x - a.x * b.z,
           a.x * b.y - a.y * b.x 

Vector function will be defined in the Math class, some of them are already implemented. Without using the float3 type, this is how it can be written using unnamed members:

float, float, float Cross((float, float, float) a, b)
    return a.1 * b.2 - a.2 * b.1,
           a.2 * b.0 - a.0 * b.2,
           a.0 * b.1 - a.1 * b.0

Tuple Extraction

It's possible to extract a tuple in a similar way as swapping variables:

float x, y, z
x, y, z = Cross(a, b)

Or if var is used, it can be written in a single line:

(var x, var y, var z) = Cross(a, b)

The var have to be written before all the variable in order to make the compiler able to decide which is an existing variable. E.g. if (var x, y, z) = ...  would be interpreted as three new variable then it wouldn't be possible to refer to an existing y, z.

For Loops

for var i in 0 ... 9
for var i in 0 .. 10

Both loops mean the same. Two dots means that i won't have the value at right, in case of three dots it will have that value.

for var x, y in 0 .. Width, 0 .. Height

This is the same thing as two nested loops. The x goes from 0 to Width-1, the y goes from 0 to Height-1. The loop with y variable is the inner one. The break command exits from both.  It can be also written like this:

for var x, y in (0, 0) .. (Width, Height)

If only one number is specified then it will be the initial or the final value of all variables. So this is the same as the previous:

for var x, y in 0 .. (Width, Height)

If there is two point, it's possible to make a single for loop that runs with all points that are in their rect. In this case the x variable goes from P1.0 to P2.0, the y goes from P1.1 to P2.1:

var P1 = (10, 12)
var P2 = (100, 110)

for var x, y in P1 ... P2
    / Something

The step can be used to specify how much the loop variables are increased. It can be both a scalar or a tuple with the same rules. It adds 1 to i and 2 to j at every cycle. The next loop increases i with 1 and j with 2:

for var i, j in 1 .. 20 step (1, 2)

Other Loops

The while, do-while loop is similar to C languages:

var i = 1
while i < 100
    i *= 2

i = 1
do
    i *= 2
while i < 100

 I created two new that the code can be written smaller with. The repeat does something as many times as specified in the parameter. the cycle makes an infinite cycle.

Structures

Structures can contain fields, methods, constructors, etc. The new operator, if the type is not specified, it creates an object with the same type as it is converted to. In this program it is the return type. The original is the var type that is always automatically changed to another type:

struct Rect
    public float X, Y, Width, Height

    public Rect(float X, Y, Width, Height)
        this.X = X
        this.Y = Y
        this.Width = Width
        this.Height = Height

    public Rect Copy()
        return new(X, Y, Width, Height)

    public Rect Copy_2()
        return new:
            X = this.X
            Y = this.Y
            Width = this.Width
            Height = this.Height

    public float GetValue(int i)
        switch i
            case 0: return X
            case 1: return Y
            case 2: return Width
            case 3: return Height
            default return 0

I would note that there is never need to use the break command at the end of the case block. But I'm not sure that there is need for the switch statement, I never use it, if conditions are much more simple in my opinion, especially in C# where the case block must be leaved with some jumping command.

Strings

The most important .NET functions have been implemented. I haven't made a GC yet, so objects will remain allocated until the application exits. It's not a problem for now.

using System

void Main()
    Console.WriteLine "adfdfgh".PadRight(10) + "Something"
    Console.WriteLine "adfdh".PadRight(10) + "Something"
    Console.WriteLine 
    Console.WriteLine "adfdfgh".Contains("fdf")
    Console.WriteLine "adfdfgh".Contains("fdfh")
    Console.WriteLine 
    Console.WriteLine "adfdfgh".Replace('d', 'f')
    Console.WriteLine "adfdfgh".Replace("d", "ddd")
    Console.WriteLine "adfdfghléáőúó".ToUpper()

Arrays

Reference Typed Arrays

This is how 1D reference array can be declared and initialized:

var Array1D_1 = new int[234]
var Array1D_2 = new[]: 1, 2, 3

var Array1D_3 = new[]:
    1
    2
    3
    
var Array1D_4 = new[]:
    1, 2
    3, 4

The compiler takes into account how many dimension are there before interpreting the initial values. The values can be separated with both brackets and new lines. If it founds one less dimensions than specified, the new lines are dimension separators too. I'm not sure it's good, I may remove it the future because it's a bit ambiguous. But it can be also made with using only brackets.

var Array2D_1 = new[,]: (1, 2), (3, 4)

var Array2D_2 = new[,]:
    1, 2
    3, 4
    
var Array2D_3 = new[,]:
    (1000, 1001, 1002, 1003, 1004, 1005
     1006, 1007, 1008, 1009, 1010, 1011)
	 
    (2000, 2001, 2002, 2003, 2004, 2005
     2006, 2007, 2008, 2009, 2010, 2011)

Fixed Size Arrays

These are value types and stored on the stack. Their type is marked with the size unlike reference arrays (e.g. int[10]). This is how can they be created:

int[5] Arr1 = new
int[5] Arr2 = default

The default keyword is the same as in C#. It's just optional to specify the type if it can be inferred. In this case it is the same as the destination variable. The same thing happens with new, it would be new (int[5])(). The new for value types means the same as default. All values in both arrays are initialized to zero. Initial value can be specified as:

var FixedArr1D = [0, 1, 2, 3]      // Type: int[4]
var FixedArr2D = [(0, 1), (2, 3)]  // Type: int[2, 2]
byte[4] FixedArr1D_2 = [0, 1, 2, 3]

The FixedArr1D_2 array can be declared without an error, because the compiler takes the type of the variable into account before evaluating the initial value.
Fixed size arrays can be converted to reference types with an implicit conversion:

double[] Arr = [0, 1, 2]
Func [0, 1, 2, 3]

void Func(double[] Arr)
    // Something
    
long[], byte[] GetArrays()
    return [0, 1, 2], [2, 3, 4, 5]

Pointer and Length

The notation of this kind of array (or rather tuple) is T[*] (T is a arbitrary type), that is actually a short form of (T*, uint_ptr Length). It can be useful for unsafe programming. I created it because I had to write two variables for the same purpose. Both reference type and fixed size arrays can be converted to it implicitly:

using System

void OutputFloats(float[*] Floats)
    for var i in 0 .. Floats.Length
        Console.WriteLine Floats[i]

void Main()
    OutputFloats [0, 1, 2]

    var Floats = Memory.Allocate(sizeof(float) * 3) to float*
    for var i in 0 .. 3: Floats[i] = i + 10.5f
    OutputFloats (Floats, 3)

Parameters with ref, out

Using ref it's possible to use a parameter as input and output. The out can be used for only output, but it makes sure that the variable gets a value:

using System

void OutputFunc(ref int x)
    Console.WriteLine x
    x++

void Func(out int x)
    x = 10

void Main()
    Func out var x
    OutputFunc ref x
    OutputFunc ref x
    OutputFunc ref x

A variable passed with ref must have a value before the function is called, out parameters must be set to a value before leaving the function. These checks can be bypassed with unsafe_ref.

Named and Optional Parameters

Only parameters that have to be specified are that don't have default value:

// The definition of BlitzMax.Graphics
IntPtr Graphics(int Width, Height, Depth = 0, Hertz = 60, Flags = 0)

Graphics 800, 600
Graphics 800, 600, 32

With named parameters, the earlier parameters are not need to be specified:

Graphics Width: 800, Height: 600
Graphics 800, 600, Hertz: 75

Properties and Indexers

They are marked with colon. Properties are handled as variables, when using them the compiler calls the set and get methods. In case of indexer parameters can be specified too:

class Class
    int _Something
    public int Something:
        get return _Something
        set _Something = value
	
    public int AutomaticallyImplementedProperty:
        get
        set
		
    public int this[int Index]:
        get return Index * 2

    public int NamedIndexer[int Index]:
        get return this[Index]
		
void Main()
    Class Obj = new
    Console.WriteLine Obj[3]
    Console.WriteLine Obj.NamedIndexer[4]

Operator Functions

Operators can be defined for structures and classes that wouldn't allow it by default:

class Class
    int _Something
	
    public static void operator ++(Class Obj)
        Obj._Something++
		
void Main()
    Class Obj = new
    Obj++

Getting the Address of a R Value

Sometimes a parameter have to be passed with a pointer to it. In Bird, the address can be queried from constants and R values too, and it automatically copies to a variable:

using System

/* The constructor of Array class:
   public Array(IDENTIFIER_PTR ArrayType, uint_ptr[*] Dimensions,
                uint_ptr ItemSize, void* InitialData = null) */

int[,] CreateIntArray2D(uint_ptr Width, Height)
    var Obj = new Array(id_desc_ptr(int[,]), [Width, Height], 4)
    return reinterpret_cast<int[,]>(Obj)

int[] CreateIntArray1D()
    const uint_ptr Length = 16
    uint_ptr[*] Dimensions = (new: Pointer = &Length, Length = 1)
    var Obj = new Array(id_desc_ptr(int[]), Dimensions, 4)
    return reinterpret_cast<int[]>(Obj)

The type of [Width, Height] expression is uint_ptr[2], so when it casted to uint_ptr* the compiler have to query the address. So it creates a new variable that will be assigned to [Width, Height] and it gets the address of this variable. It does the same with &Length in the second function. reinterpret_cast basically does nothing, it just changes the type of an expression node like casting a pointer.

Reference Equality Operator

The === and !== operator can be used to compare the references of objects. It does the same thing as the Object.ReferenceEquals. The == can be also used for this, but it can be overwritten with an operator function.

public bool StringReferenceEquals(string A, B)
    return A === B

Higher Order Functions

The type of a function can be marked with ->. At the left side there are the input parameters, at the right side the output parameters. The calling convention and modifiers also can be specified. E.g. birdcall string, object -> int, float. When there are multiple outputs, the return type becomes a tuple. In the future I plan to allow all functions to have multiple output in a similar way.

using System

int GetInt(int x)
    return x + 1
	
int Test((int -> int) Func)
    return Func(2)

void Main()
    var Time = Environment.TickCount
    var Sum = 0

    for var i in 0 .. 100000000
        Sum += Test(GetInt)

    Time = Environment.TickCount - Time
    Console.WriteLine "Time: " + Time + " ms"
    Console.WriteLine "Sum: " + Sum

This little sample shows how it works. I made it in C# too, and these are the performance result with my machine:

Compiler Bird C#
Time 719 ms 2234 ms

Actually it is implemented very simply. Higher order functions are just a tuples of an object and a function pointer (object Self, void* Pointer). The Self member can be null if the function is static. It's possible to create a static function pointer with the static keyword: static int -> float. When a nonstatic function is called, the Pointer member is converted to a function pointer. If the Self is not null, it is also added to the parameters. This is how the Test function is extracted:

int Test((int -> int) Func)
    return if Func.Self == null: (Func.Pointer to (static int -> int))(2)
           else (Func.Pointer to (static object, int -> int))(Func.Self, 2)

To make it run faster, the parameter can be replaced to a function pointer. It runs in 542 ms in this way.

int Test((static int -> int) Func)
    return Func(2)

History

  • 1/1/2013: Higher order functions, stack alignment, and many refactoring
  • 10/11/2012: Scope resolution operator, changed casting operator, the to keyword has the same syntax as is and as operator and it doesn't allow ambiguous code.
  • 22/9/2012: Parameter arrays, better x86 performance
  • 18/8/2012: Implemented stackalloc, pointer and length arrays, new and default without specifying the type, static constructors, checked, unchecked, generic parameters with <> (only at reinterpret_cast)
  • 18/7/2012: Object type casting, boxing, unboxing, is as xor operator, low-level reflection, improved x86 code generation
  • 16/6/2012: Exception handling, try-catch-finally, constants also can be declared inside a function
  • 19/5/2012: Arrays, object initializations, address can be taken of r values, ref, out parameters, added Visual C++ compilation of samples
  • 2/5/2012: Improved performance, identifier aliases instead of typedefs, strings, reference equality operator (===, !==), binary files can be linked into the assembly, changed the name from Anonymus to Bird

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

About the Author

Dávid Kocsis
Student
Hungary Hungary
Member
I've been programming for 7 years. My first big project was a remake of a nice bomberman game called Dyna. When i was little i played a lot with it. Now i'm working on a new programming language.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionAssembly listingmemberjojo_dfb27 Feb '13 - 10:08 
The older version of Bird (Anonymous) would produce a file containing the generated x86 assembly, but the latest version does not. Is there a compiler option that will restore this?
 
Thanks
 
nevermind :/ I noticed the commanline arg -format that seems to work.
 
great job!
AnswerRe: Assembly listingmemberDávid Kocsis27 Feb '13 - 20:07 
Thanks,
The output files including the x86 assembly should have been in the .bird directory regardless the -format option for easy cleaning up.
QuestionIs this a clone of the D programming language?memberKoutheir8 Jan '13 - 4:18 
Is this a clone of the D programming language?
 
Koutheir Attouchi
AnswerRe: Is this a clone of the D programming language?memberDávid Kocsis29 Jan '13 - 8:43 
No, I don't think that it is similar to D.
GeneralRe: Is this a clone of the D programming language?memberKoutheir29 Jan '13 - 8:51 
In what major respect is this language different from D?
 
Koutheir Attouchi
GeneralRe: Is this a clone of the D programming language?memberDávid Kocsis30 Jan '13 - 2:21 
I don't really know D, so I can only tell what I see for the first look. I think D takes less attention to readability and uses C like syntax. It has unique features that are not exist in Bird or implemented differently. The syntax of tuples(http://dlang.org/tuple.html[^]) could have been made better I think, the user has to write a lot. Bird also has features that I don't know in other languages. But D language is complete language, and my one needs to be finished. Performance of D seems to be similar to C#/C++.
 
But why do you think that Bird is a clone of D? There are many differences, not even minor ones.
QuestionAlmost 5...memberborax78 Jan '13 - 2:34 
The indication of code blocks are done based on the whitespaces in front of lines. One scope always have the same number of whitespaces
 
Sorry man, but making a whitespaces a vital part of syntax is really a bad practice. Sure, some languages do it this way, but it makes your language strongly depandant on the text editor being used to write your code. Note, that not all editors handle whitespaces the same way (and there is no "good" or "bad" way): consider Unix/DOS ways of line endings (CR+LF vs LF), converting tabs to spaces, automatic indentation, etc. So, even if your Bird code compiles clearly, it may work differently when compiled from another IDE.
Also, it forces the user to adhere to a certain formatting style.
I would definitely use some sort of BEGIN-END keywords or parens/brackets to indicate code blocks.
 
But still good work, all in all.
AnswerRe: Almost 5...memberDávid Kocsis29 Jan '13 - 8:37 
I think it's possible to allow something like that to not force the user to a formatting:
public uint_ptr Write(byte[*] Buffer)
    var BytesWritten = 0up
    (
while BytesWritten < Buffer.Length
    var Written = _Stream.Write(Buffer[BytesWritten .. ])
    if Written == 0: return BytesWritten
	
    BytesWritten += Written
	
return BytesWritten
    )
 
A colon would be necessary here to mark that the next block is the inner part of the while. If it's not placed there would be an empty loop warning.
public uint_ptr Write(byte[*] Buffer)
(
    var BytesWritten = 0up
    while BytesWritten < Buffer.Length:
    (
    var Written = _Stream.Write(Buffer[BytesWritten .. ])
    if Written == 0: return BytesWritten
	
    BytesWritten += Written
    )
	
    return BytesWritten
)
 
Original function:
public uint_ptr Write(byte[*] Buffer)
    var BytesWritten = 0up
    while BytesWritten < Buffer.Length
        var Written = _Stream.Write(Buffer[BytesWritten .. ])
        if Written == 0: return BytesWritten
	
        BytesWritten += Written
	
    return BytesWritten
 
CR+LF and LF are both accepted by the compiler. They can be found easily. The more problematic thing is the tabs, currently the size of a tab is stored in a variable. It could be set for each project.
 
In a version that is mostly compatible with C#, it would look like this:
public uint_ptr Write(byte[*] Buffer)
{
    var BytesWritten = 0up;
    while (BytesWritten < Buffer.Length)
    {
        var Written = _Stream.Write(Buffer[BytesWritten .. ]);
        if (Written == 0) return BytesWritten;
	
        BytesWritten += Written;
    }
	
    return BytesWritten;
}
 
I have already started to make changes to allow easy development of both Bird and C# like syntax, but it takes times and there are other things with higher priority too.
GeneralMy vote of 4memberSeattleC++7 Jan '13 - 10:38 
great effort. still preliminary, that's why the 4
GeneralRe: My vote of 4memberDávid Kocsis29 Jan '13 - 8:47 
Yes, there are many things to be done, but I work on them.
Questiondesigning languagesmemberSeattleC++7 Jan '13 - 10:38 
Very interesting. As a person who has actually designed and implemented two whole programming languages (that you've never heard of, but one was in commercial use) let me say that bird is a pretty impressive effort. Don't let the haters discourage you. Unless they've designed a programming language themselves, they have no standing to complain about anything you chose to do. Notice the haters don't say, "Your syntax is crap because..." or "Your language should do it this way..."
 
The syntax (controlled statements indented) is like python. Same with the tuple idea, sort of. Do you know python? If not, you should have a look, as python seems to be pointed at solving many problems you also are interested in.
 
My advice for programming language designers is to become familiar with as many other languages as possible. Then you can say, this feature is like python and that feature is like java, and so forth.
 
A previous poster said you should talk more about why you picked certain features, and I agree. It's much harder for the haters to call your efforts junk if you can express a reason for each design decision. It may also raise the quality of suggestions you get.
AnswerRe: designing languagesmemberDávid Kocsis29 Jan '13 - 7:45 
Thank you. I haven't used Python, but I read something about it. The indenting idea came from it I think, but I didn't know that there are tuples Python. In my opinion the drawbacks of Python are duck typing and performance.
In the article there are many things to be rewritten/corrected, I want to improve it, but when I have time, I usually rather do programming. I will try to write more about why I made the features in the next version.
GeneralMy vote of 3memberDanielSheets2 Jan '13 - 2:01 
Readability isnt there for me. Its more like a mixture of VB and C#. Maybe I'm just used to the angle brackets.

Its a great experiment, but (and hopefully I'm wrong) I'm thinking it will end up as one of the hundreds of other unused, small programming languages.

As an echo to the age thing... I wrote my first computer program on a Tandy CoCo III at the ripe old age of 10. I imagine you have a great career as a software engineer in your future.
GeneralRe: My vote of 3memberDávid Kocsis2 Jan '13 - 8:41 
Thanks for telling me your opinion. I don't really know and like VB, I didn't want to make it similar to it. But as I see the syntax could be an obstacle because there are people who don't like it, so I'll surely make a C like syntax too at some time.
QuestionGreat workmemberamity20011 Jan '13 - 18:58 
Great work.Thumbs Up | :thumbsup: Thumbs Up | :thumbsup: Thumbs Up | :thumbsup: Thumbs Up | :thumbsup: Thumbs Up | :thumbsup:
I would suggest you to add some comparison study.
 
All the best... Smile | :)
AnswerRe: Great workmemberDávid Kocsis1 Jan '13 - 21:22 
Thank you. Some comparison wouldn't be hard to do.
GeneralMy vote of 5memberJ. Wijaya12 Nov '12 - 15:18 
my vote are 5 for this amazing article.
GeneralRe: My vote of 5memberDávid Kocsis12 Nov '12 - 18:47 
Thanks
Questionmy vote is 2memberAlex_112 Nov '12 - 11:28 
This Bird is an bad version of VB, in other words rubbish.
The power of the language is mostly in the syntax and in the supporting framework.
You have none of these. It is useless. However as a programming exercise you have done a good job, but it has nothing to do with the professional software.
AnswerRe: my vote is 2memberabdurahman ibn hattab3 Dec '12 - 22:04 
You are partly wrong. The syntax is near to optimal. If you still think it doesn't then we all would like to hear at what places the syntax is bad.
Question3D graphics is about 1.5-2 times slower in C# than in C++?memberMihai Maerean11 Nov '12 - 22:12 
You say that "3D graphics is about 1.5-2 times slower in C# than in C++."
Can you please show some recent benchmarks that prove this statement?
 
Thank you.
AnswerRe: 3D graphics is about 1.5-2 times slower in C# than in C++?memberDávid Kocsis12 Nov '12 - 3:55 
I wrote that based on one: http://code4k.blogspot.hu/2011/03/benchmarking-cnet-direct3d-11-apis-vs.html[^]
I could have include this link to the article, nevermind.
GeneralMy vote of 5membermr.smart29 Sep '12 - 2:39 
Even if I don't like syntax and semantics of your language in some respects, this is great stuff. Keep up the good work!
GeneralRe: My vote of 5memberDávid Kocsis29 Sep '12 - 9:27 
Thanks, there will probably be a C# like syntax, because some people don't like the current. I started it, but I stopped working on it for a while to be able to make other things too.
GeneralMy vote of 2memberGalatei24 Sep '12 - 11:46 
Syntax is bad, unbearable and doesn't bring anything new. Copies too much from many existing languages.
GeneralContributionmemberA. Rajesh Kumar24 Sep '12 - 7:21 
Hi David,
 
I'm impressed with this new language. I am interested to contribute to this language. Please let me know if you are looking for any development contributions.
 
Regards,
Rajesh
GeneralRe: ContributionmemberDávid Kocsis25 Sep '12 - 7:58 
Hi!
 
Thank You. I think we can speak about it. If you wish I can send you my contact addresses in e-mail.
 
Regards,
David
GeneralMy vote of 5memberRomTibi23 Sep '12 - 8:23 
From new things raises good ones
GeneralRe: My vote of 5memberDávid Kocsis23 Sep '12 - 9:24 
Thank You.
QuestionI am intriguedmemberOleg Shilo22 Sep '12 - 23:59 
As already know you have done some brilliant work. My simple "5" does not even accurately reflect the level of the work you have presented here. And lately it is not so often we have genuine "5-star" articles.
 
But I am even more intrigued with the future of your project. It would be really sad if Bird stays as an impressive experiment only.
 
You hinted that you are planing to develop IDE. Fantastic. Of course you can go with the VS extension but I think a standalone IDE may give you more flexibility (freedom).
 
Also consider building up the Bird community. Do not underestimate the importance of this. Sourceforge, Codeplex, GoogleCode/GoogleGroups they are all good options for this but of course the choice depends on so many things (including licencing).
 
Something tells me that you are already well prepared for the challenges ahead of you.
AnswerRe: I am intriguedmemberDávid Kocsis23 Sep '12 - 9:24 
Thank You. Github seems to be the best for me, but I don't really know them. I haven't decided yet which and how to use.
QuestionBird thoughtsmembermfc10220 Aug '12 - 9:00 
Lots of interesting pieces there .. but have you studied Rexx (and NetRexx in particular)? Many of the same aims.
 
Mike
AnswerRe: Bird thoughtsmemberDávid Kocsis21 Aug '12 - 10:11 
Thanks!
I never heard of Rex . It doesn't seem to be very good for me. Its sintax is not that simple in my opinion for the first look.
GeneralMy vote of 5 [modified]memberpasztorpisti20 Aug '12 - 3:57 
Very nice! If I had more time I would definitely kill some of it to explore the topic of compiler construction. Smile | :) I have a few advices regarding bird and the article: Instead of just listing the language features you should give some more explanation on your design decisions! Your language doesnt seem strongly typed, what was your intention with this? (Do you know the drawbacks of ducktyping?) Who is this language for? For example when you describe the for loop: you give several ways to do it. In my opinion the more ways a language gives you to perform a specific task, the worse the language is! (I hate perl for this simple reason.) The for loop is in general used to iterate over an iteratable object. Its another question what kind of iteratable objects are provided by the language, and what kind of iteratable object can be written by a programmer if its allowed at all. A language should be kept as simple as possible without sacrificing its power! Your syntax remdinds me my favorite scripting language: python, check out how simple its basic syntax is! So in general: give more answers to this question: why? by explaining your desing decisions. This helps you too to find out what is good, and what isnt in practice! You could also write some more about optimization and code generation, not in general, but about your methods that you found out in your journey during compiler construction. Smile | :)

modified 25 Sep '12 - 9:32.

GeneralRe: My vote of 5memberDávid Kocsis20 Aug '12 - 20:37 
Thank You! I will try to follow your advices in the future. You are right about that I should explain more.
 
pasztorpisti wrote:
Your language doesnt seem strongly typed, what was your intention with this? (Do you know the drawbacks of ducktyping?)
Actually it's strongly typed and does type inference to make the unambiguous things take less code. It would be impossible to achive similar performace otherwise.
 
pasztorpisti wrote:
For example when you describe the for loop: you give several ways to do it. In my opinion the more ways a language gives you to perform a specific task, the worse the language is!
I only added a new way to write more for loops in one for the same reason, to make coding take less time and make it simpler. And it seemed to be straightforward for me. A simple for loop is like in Python:
for count in range(1, 11):
    print(count)
 
for var count in 1 .. 11
    Console.WriteLine count
And if you want to write two:
for a in range(1, 4):
    for b in range(1, 4):
        print(a, " * ", b, " = ", a * b)
 
for var a, b in 1 .. 4
    Console.WriteLine a + " * " + b + " = " + (a * b)
To be honest I don't find it bad, in the sample there was "for var x, y in P1 .. P2" (where P1 and P2 are (int, int)), In my opinion it's easy was to go through all cordiantes between two points. But there was some things that were smaller, but I removed, because it was bad.
 
pasztorpisti wrote:
You could also write some more about optimization and code generation, not in general, but about your methods that you found out in your journey during compiler construction. Smile | :)
It's hard to write about code generation in detail and clearly. It's the most complex part of it, and sometimes even I don't know how something works exactly. I have to look at the code to tell it. And I'm less willing to write than developing. But I'll keep in mind to update it too.
GeneralRe: My vote of 5memberpasztorpisti20 Aug '12 - 21:14 
Dávid Kocsis wrote:
Actually it's strongly typed and does type inference

My bad, I always assume ducktyping when it comes to type inference. For some reason I don't like it because often makes reading others' code difficult when the assigned expression is a variable or function call or whatever that doesn't help you to find out the type. On the other hand you still have to write there the "var" keyword that makes some noise, is that there to speed up parsing? (Another design decision you should write about Smile | :) )
Dávid Kocsis wrote:
I only added a new way to write more for loops in one for the same reason, to make coding take less time and make it simpler. And it seemed to be straightforward for me. A simple for loop is like in Python:

for count in range(1, 11):
    print(count)
 
for var count in 1 .. 11
    Console.WriteLine count

In older python versions the range() function returns a list object that contains numbers from 1 to 11 (with default steps = 1), the newer python versions return a generator function. The common in the two python solutions is that both the list and the generator function is iterable, and the language gives you the opportunity to write your own iterable objects - same is true some other high level languages like C# and java. For example you can use for (Animal x : animals) in java to iterate over a arbitrary container instance that contains Animals. Your for loop is OK, it just isn't a general one that would be awesome in case of iterable containers.
Dávid Kocsis wrote:
It's hard to write about code generation in detail and clearly. It's the most complex part of it, and sometimes even I don't know how something works exactly. I have to look at the code to tell it. And I'm less willing to write than developing. But I'll keep in mind to update it too.

Unfortunately I share the same opinion about writing/developing. Smile | :) I have quite a few article ideas but I'm hell lazy to actually start putting together an article. Still, if you take the trouble to write about it then try to pick a few techniques that are very useful still easy to implement. Depending on the verbosity you use that topic can fill a whole new article.
GeneralRe: My vote of 5memberDávid Kocsis21 Aug '12 - 10:02 
pasztorpisti wrote:
My bad, I always assume ducktyping when it comes to type inference. For some reason I don't like it because often makes reading others' code difficult when the assigned expression is a variable or function call or whatever that doesn't help you to find out the type. On the other hand you still have to write there the "var" keyword that makes some noise, is that there to speed up parsing? (Another design decision you should write about Smile | :) )
As I know ducktyping means that the method is resolved at runtime, but it's resolved at compile time in my language. A good IDE shows the type of a variable when you move the cursor over it. I plan to do the same, if I ever get there. var is not to speed up parsing, it's to avoid bugs when variable's name is misspelled. I was thinking about allow not using it, but I'm not sure it would be good.
 
pasztorpisti wrote:
In older python versions the range() function returns a list object that contains numbers from 1 to 11 (with default steps = 1), the newer python versions return a generator function. The common in the two python solutions is that both the list and the generator function is iterable, and the language gives you the opportunity to write your own iterable objects - same is true some other high level languages like C# and java. For example you can use for (Animal x : animals) in java to iterate over a arbitrary container instance that contains Animals. Your for loop is OK, it just isn't a general one that would be awesome in case of iterable containers.
Iterators will be implemented later, but if there wouldn't be a counter for loop, it would make performance much worse.
 
pasztorpisti wrote:
Still, if you take the trouble to write about it then try to pick a few techniques that are very useful still easy to implement. Depending on the verbosity you use that topic can fill a whole new article.
I don't know how will I do it yet, it won't be done so soon probably.
GeneralRe: My vote of 5memberpasztorpisti21 Aug '12 - 10:46 
Good points. Incorporate them to the article! Smile | :)
 
Cheers,
pasztorpisti
GeneralRe: My vote of 5memberDávid Kocsis21 Aug '12 - 20:09 
Okey, Thanks
QuestionC# is nativememberGerhardKreuzer24 Jul '12 - 2:10 
Hi,
C# is a native language as long you use the program more than once, which is a quite common program usage pattern, I guess.
During the first usage, the IL code is compiled JIT (just in time) and from now on, it is native as each other language.
The libs were partly written in assembler, so I think, you hardly can get a faster program.
Of course, you can left beside all runtime checks, as C++ do (or even never has), but is this really a wise decition?
 
With best regards
 
Gerhard
AnswerRe: C# is nativememberDávid Kocsis24 Jul '12 - 3:45 
Hi!
 
Every language that runs on the .NET framework is called managed (http://en.wikipedia.org/wiki/Managed_code[^]).
I may try to include C# in the performance tests, but it's not as simple as C++. I have no idea how to import functions without performance impact. The best way seems to be a wrapper library in C++/CLI.
Many people say that C++ is the fastest language, but I have to admit that C# performs well sometimes, even though its disassemly looks really bad. Game developers use C++, DirectX for C# is also much slower. The best would be if high-level wouldn't mean restrictions to low-level usage and performance.
Runtime checks in my language will be switchable, so it won't slow down anything and doesn't make debugging a nightmare.
 
Best regards,
David
QuestionC++ is slow?memberVitaly Tomilov18 Jul '12 - 8:54 
Well, that's a news...
 
You obviously didn't use it enough, making such statements. To develop fast in C++ you need to use professional frameworks. And, of course, things like MFC or whatever Microsoft bundles VC++ with isn't good at all.
 
What is good - Qt[^] It offers a professional multi-platform framework that's more powerful than .NET 4.
Let's agree to disagree!
Boris the animal Just Boris.

AnswerRe: C++ is slow?memberDávid Kocsis18 Jul '12 - 10:59 
I know that Qt is powerful, but a library can't make C++ neat. I wouldn't be able to use Qt if I would develop Bird in C++ because basically all I need is simple file I/O (with little exaggeration). Also, IMHO Qt for .NET could be even more powerful than in C++.
GeneralRe: C++ is slow?memberFabian Tamp22 Jul '12 - 20:03 
Qt does make C++ neater, in the sense that it's higher level, but it's still a library on top of a programming language. Also, I've personally found that Qt suffers from the "Jack of all trades, master of none" problem that plagues most cross-platform software - whilst it works to a standard on all platforms, it doesn't really shine on any of them.
GeneralRe: C++ is slow?memberDávid Kocsis22 Jul '12 - 22:56 
I meant it can't make better the language itself, but it obviously can reduce code lines where it can be used. The best library or language depends on the task and none of them are perfect for everything. And it also depends on the developer's taste and knowledge. It's useless to argue on which is the best.
GeneralThanks for sharingmemberSomnath_Mali17 Jun '12 - 20:15 
Thanks for sharing Smile | :)
GeneralDownloadmemberDávid Kocsis16 Jun '12 - 19:55 
If the download link doesn't work, you can use this: https://dl.dropbox.com/u/28475953/Bird.zip[^]
GeneralMy vote of 5memberSoMad16 Jun '12 - 19:04 
This is very impressive work!
I will be watching your updates to Bird and the article.
 
Thumbs up.
Soren Madsen
GeneralRe: My vote of 5memberDávid Kocsis16 Jun '12 - 19:50 
Thank You
QuestionNamespacesmemberumlcat25 May '12 - 7:17 
Very Good.
 
I suggest add a new required namespace for each file, and do not. Otherwise, your language may get in the same problem as PHP, C, C++, where namespaces where added later.
 
------
HelloByrdExample.byrd
------
namespace HelloByrdExample
 
  rem these go inside the namespace, not outside
  using System
 
  public void Main()
    print "Hello Little Byrd,"
    print "Please sing a song"
------
 
Cheers.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 1 Jan 2013
Article Copyright 2011 by Dávid Kocsis
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid