Click here to Skip to main content
15,885,216 members
Articles / High Performance Computing / Vectorization

Bird Programming Language: Part 1

Rate me:
Please Sign up or sign in to vote.
4.92/5 (129 votes)
1 Jan 2013GPL312 min read 376.2K   2.7K   153  
A new general purpose language that aims to be fast, high level and simple to use.

rem
	int GetInt()
		return 0

	bool LinkedNodesTest(int x, y)
		return x < GetInt() < GetInt() < y
		
	bool LinkedNodesTest2(int x, y)
		return (if x < GetInt() < y then 1 else 0) ==
			   (if x < GetInt() < y then 1 else 0)

	void Test(int x, y)
		Test x + y, (x - y) + (x - y)
		
	void RefTest(ref int a)
		a = 234
	
		int x
		RefTest ref x
		RefTest ref a

	class Base
		int Member = 10

		int Func()
			Member = 10
			return 0

	class MyStruct : Base
		int x
	
		rem MyStruct(int x, y)
			: base x, y
		
	int Func(MyStruct S)
		S.Member = 123
		S.x = 123

		return S.Func() + S.Func()
		
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
void SwapTest()
	var x = 0, y = 0
	x, y = y, x
	
int TestIntTest((int, int) a)
	(var x, var y) = a
	x, y = y, x
	return x + y

type float2 = (float, float)

float Test(float2 a)
	(var x, var y) = a
	x, y = y, x
	return x + y

rem
	float2 Ret Test(int x)
		Ret = x, x
		if x == 0 then return
		Ret.0 = 123
	
	float x, y MultiRetTest(float v)
		x = v + v
		if x == 0 then return
		y = v * v

	float2 NewTest()
		var v1 = new float2, v2 = new float2
		return v1 + v2

	float2 Mul((int, float) a, (float, int) b)
		return a * b

	int, int CreateTuple(float x, y)
		return (int, int)(x, y)
		return (int)x, (int)y

	float x, y Test((float x, y) Ret)
		'return Ret
		return 0, 1

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem
	int NullCoalescingTest(int* Ptr1, Ptr2)
		return *(Ptr1 ?? Ptr2)

	struct SNStruct
		SNStruct* Ptr

	SNStruct* SafeNavigationTest(SNStruct* Ptr)
		return Ptr?->Ptr?->Ptr?->Ptr
	
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem
	class Vector
		int x, y

		Vector(int x, y)
			this.x = x
			this.y = y

		bool NotNullVec()
			return !(x == 0 and y == 0)

	class DVector : Vector
		double Length

		DVector(int x, y) : base x, y
			Length = sqrt(x * x + y * y)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer
Hungary Hungary
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions