Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

Bird Programming Language: Part 1

, 1 Jan 2013
A new general purpose language that aims to be fast, high level and simple to use.
Bird-noexe.zip
Bird
Archives
crt2.o
crtbegin.o
crtend.o
libadvapi32.a
libcomctl32.a
libcomdlg32.a
libgcc.a
libgdi32.a
libglu32.a
libkernel32.a
libmingw32.a
libmingwex.a
libmoldname.a
libmsvcrt.a
libopengl32.a
libshell32.a
libstdc++.a
libuser32.a
libwinmm.a
libwsock32.a
Libraries
BirdCore
Array.bird
BigInteger.bird
BinaryRW.bird
BirdCore.a
BirdCore.blib
CategoryData.dat
Console.bird
Convert.bird
Debug.bird
Entry.bird
Environment.bird
Exception.bird
Float.bird
LEB128.bird
Math.bird
Memory.bird
Object.bird
Random.bird
Reflection.bird
StandardC.bird
Stream.bird
String.bird
ToLowerData.dat
ToUpperData.dat
Types.bird
ValueType.bird
Win32.bird
x86Helper.bird
BlitzMax
.bmx
Launcher.bmx.gui.release.win32.x86.o
appstub.release.win32.x86.a
bank.release.win32.x86.a
bankstream.release.win32.x86.a
blitz.release.win32.x86.a
BlitzMax.a
BlitzMax.bird
BlitzMax.blib
d3d7max2d.release.win32.x86.a
d3d9max2d.release.win32.x86.a
directx.release.win32.x86.a
dxgraphics.release.win32.x86.a
event.release.win32.x86.a
filesystem.release.win32.x86.a
font.release.win32.x86.a
glgraphics.release.win32.x86.a
glmax2d.release.win32.x86.a
graphics.release.win32.x86.a
hook.release.win32.x86.a
keycodes.release.win32.x86.a
Launcher.bmx
libpng.release.win32.x86.a
linkedlist.release.win32.x86.a
math.release.win32.x86.a
max2d.release.win32.x86.a
opengl.release.win32.x86.a
pixmap.release.win32.x86.a
pngloader.release.win32.x86.a
polledinput.release.win32.x86.a
standardio.release.win32.x86.a
stdc.release.win32.x86.a
stream.release.win32.x86.a
system.release.win32.x86.a
textstream.release.win32.x86.a
win32.release.win32.x86.a
zlib.release.win32.x86.a
PrgLinec.bmx
Samples
Circles
Circles.bird
CppMain.bird
Fire
Fire.bird
Higher Order Functions
C#
Higher Order Functions.v11.suo
Properties
Test.bird
msvcrt.lib
Reflection
Reflection.bird
Squares
Squares.bird
Template
Template.bird
Source
Base
Bird.v11.suo
Expressions
Identifiers
Languages
NativeCode
Properties
Recognizers
Expressions
Scopes
x86
Thumbs.db
Bird.zip
crt2.o
crtbegin.o
crtend.o
libadvapi32.a
libcomctl32.a
libcomdlg32.a
libgcc.a
libgdi32.a
libglu32.a
libkernel32.a
libmingw32.a
libmingwex.a
libmoldname.a
libmsvcrt.a
libopengl32.a
libshell32.a
libstdc++.a
libuser32.a
libwinmm.a
libwsock32.a
Binaries
ar.exe
Bird.exe
fasm.exe
ld.exe
libiconv-2.dll
libintl-8.dll
Array.bird
BigInteger.bird
BinaryRW.bird
BirdCore.a
BirdCore.blib
CategoryData.dat
Console.bird
Convert.bird
Debug.bird
Entry.bird
Environment.bird
Exception.bird
Float.bird
LEB128.bird
Math.bird
Memory.bird
Object.bird
Random.bird
Reflection.bird
StandardC.bird
Stream.bird
String.bird
ToLowerData.dat
ToUpperData.dat
Types.bird
ValueType.bird
Win32.bird
x86Helper.bird
Launcher.bmx.gui.release.win32.x86.o
appstub.release.win32.x86.a
bank.release.win32.x86.a
bankstream.release.win32.x86.a
blitz.release.win32.x86.a
BlitzMax.a
BlitzMax.bird
BlitzMax.blib
d3d7max2d.release.win32.x86.a
d3d9max2d.release.win32.x86.a
directx.release.win32.x86.a
dxgraphics.release.win32.x86.a
event.release.win32.x86.a
filesystem.release.win32.x86.a
font.release.win32.x86.a
glgraphics.release.win32.x86.a
glmax2d.release.win32.x86.a
graphics.release.win32.x86.a
hook.release.win32.x86.a
keycodes.release.win32.x86.a
Launcher.bmx
libpng.release.win32.x86.a
linkedlist.release.win32.x86.a
math.release.win32.x86.a
max2d.release.win32.x86.a
opengl.release.win32.x86.a
pixmap.release.win32.x86.a
pngloader.release.win32.x86.a
polledinput.release.win32.x86.a
standardio.release.win32.x86.a
stdc.release.win32.x86.a
stream.release.win32.x86.a
system.release.win32.x86.a
textstream.release.win32.x86.a
win32.release.win32.x86.a
zlib.release.win32.x86.a
PrgLinec.bmx
PrgLinec.exe
Circles.bird
CppMain.bird
Fire.bird
Higher Order Functions.v11.suo
Test.bird
msvcrt.lib
Reflection.bird
Squares.bird
Template.bird
Bird.v11.suo
Thumbs.db
examples.zip
Examples
As.exe
AsLibs.a
PerfTest
Launcher.bmx
Squares
.bmx
Launcher.bmx
Template
Launcher.bmx
source.zip
Anonymus 7_1
Anonymus.csproj.user
Anonymus.idc
Anonymus.pidb
Anonymus.suo
Anonymus.userprefs
Base
Expressions
Lib
Long
LongDivTest.bmx
ULongConv.bmx
Math
MISZ
AsLibs.a
PerfTest
Launcher.bmx
Squares
Launcher.bmx
Template
Launcher.bmx
PrgLinec.bmx
PrgLinec.exe
Properties
Scopes
Txt
Asm.docx
Code.docx
Lib.aslib
~$Code.docx
x86
rem
	command in command
	asm command
	vec, long ops
	unnessesary casting params, return value
	GetNodePos() -> GetExprCode()
	x86Compiler.MoveData() SSEReg -> GReg

	cast nodes
	x86 func scope
	TypeMgrPlugIn: Assignment
	x86NodeData.Input
	.Constructor
	ref assignvar
	new parameters
	TypeMgr, Compiler plugin node replacing

	Optimizations:
		swap
		index op
		loop unwinding
		a = 10; print a -> print 10
		same func args
		var in eax
		use lea
		vars in same pos
		MoveCondBranch with Casting
		struct align 16
		imul 3
		vars in fpu regs
		push long arg after sub add
		for loops: dec reg, jnz lbl

	TODO:
		function overloading
		func param def
		goto only outer
		multi-line expr conds
		x64

		?. op					| var obj = valami?.a?.b ' ha egyik null akkor obj = null
		?: op					| var obj = valami ?: "sdfdf" ' ha null, akkor sdfdf, egyébként valami
								| var obj = valami ?null "sdfdf"
		in op					| x in { 1, 3, 5 } ' not { 1, 3, 5 }.Contains(x)
		
void VarInExpr(int a)
	if (var b = a * 2) > 10
		VarInExpr b
		b++
		VarInExpr b
	else
		VarInExpr b + 1
		
bool Test1232(int x, y)
	return x == y and Test1232(x - 1, y - 2)

void Test123(int x)
	for var a = 0 until x
		if a == 10 then break

long Add(long A, long B)
	var Z = A + B
	return Z * Z

uint FloatToUnsigned(float f)
	return (uint)f

float UnsignedToFloat(uint i)
	return (float)i
		
int Main(int x)
	int d

	if x < 0 then d = 1
	else if x > 0 then d = -1
	else d = 0

	return d

void CastingTest(int* pInt)
	var pByte = (byte*)pInt

	pInt[0] = 345
	pByte[2] = 23b
	void* pVoid = pByte + 3
	
int Fib(int x)
	if x < 2 then return 1
	else return Fib(x - 1) + Fib(x - 2)

#define min(x, y) if x < y then x else y
#define max(x, y) if x < y then x else y

int MacroTest(int x, y)
	var m = min(x, y)
	var ma = max(x, y)
	return ma / m

bool Func(int Number)
	while Number > 9
		var Ossz = 0
		while Number <> 0
			Ossz += Number % 10
			Number /= 10

		Number = Ossz

	return Number == 0	

int TestF(int x)
	if 0 < TestF(x) * 2 < 10 then return 0
	else return x
		
int Main456(int x)
	'(var a = x * 2) < 10

	if (var a = x * 2) < 10 then return 0
	else if (var b = x * 2) < 20 then return 1
	else if (var c = x * 2) < 30 then return 2
	else return c
	
int Test2(int x)
	return Test2(x) * 2

int Test456(int x)
	return Test456(x) * 2
	x = 10

int ElseIfTest(int x)
	if x == 0 then return 0
	else if x == 1 then return 1
	else if x == 2 then return 2
	else return -1
		
float Zero = 0, One = 1 

#define MACRO(x, y) x * y + x
int Test456456(int x, y, z)
	if (x > 0 and y > 0) or x == y
		return MACRO(x + z, y)
	else
		return MACRO(x, y + z)
				
int CantBeTest(int a)
	return CantBeTest(if 0 < CantBeTest(a) < 10 then 0 else a)

float ByteToFloat(byte a)
	return a

byte FloatToByte(float a)
	return (byte)a

float Testert(int x)
	int y = x
	return y

float FltCastTest(int x)
	return x + x

int FltCastTest2(float x)
	return (int)x

bool FltTst(float x, y)
	return x == y

float FloatTest(float x, y)
	if x == y then return 0
	return (float)((x + y) * pi)

double FloatTest2(float x)
	return FloatTest((float)x, (float)x * 2)

int DivTest(int x, y)
	return x / y

int LocalVarTest(int x, y)
	var a = x + y
	var b = x * y
	var c = x - y
	var d = x / y
	var e = x * y

	return (a + b) * (c + d) * e
	
void SetVar(int* p, int From, Count)
	var pVar = p

	for int i = 0 until Count
		pVar[i] = From + i
		
void SetVar2(int* pVar, int From, Count)
	for int i = 0 until Count
		pVar[i] = From + i

int ShlTest(int x)
	return x * 8

int ShrTest(int x)
	return x / 8

void PointerTest(int* pInt, int x, y)
	var p2Int = &pInt[2]
	pInt = null

int CantBeTest2(int a)
	return if 0 < CantBeTest2(a) < 10 then 0 else a

bool Test(int x, y, dif)
	return -dif <= x - y <= dif

byte Test123123(byte x)
	return (byte)((x + 1b) * 123b)

byte ByteTest(byte x, y)
	return (((((x - y) + (x - y)) - ((x - y) + (x - y))) + (((x - y) + (x - y)) - ((x - y) + (x - y)))) - ((((x - y) + (x - y)) - ((x - y) + (x - y))) + (((x - y) + (x - y)) - ((x - y) + (x - y))))) + (((((x - y) + (x - y)) - ((x - y) + (x - y))) + (((x - y) + (x - y)) - ((x - y) + (x - y)))) - ((((x - y) + (x - y)) - ((x - y) + (x - y))) + (((x - y) + (x - y)) - ((x - y) + (x - y)))))

int Test24(int x)
	var Ret = x
	Test24 Ret
	return Ret

int Test22345()
	var Ret = 0
	for int x = 1 to 10
		Ret += x % 4
	
	Test22345
	return Ret

bool Prim(int x)
	for var a = 2 until x
		if x % a == 0 then return false

	return true 

int Test5(int x, y)
	return ((x * y) + (x * y)) - ((x * y) + (x * y))

int Test4(int x)
	return Fib(Fib(Fib(10)))

int Test345(int x, y, z)
	return (x + y) * (y - z)

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)

Share

About the Author

Dávid Kocsis
Student
Hungary Hungary
I've been programming for 8 years. My first big project was a remake of a nice bomberman game called Dyna Blaster. When i was little i played a lot with it. Now i'm working on a new programming language and code generator.
I would like to work with someone, so feel free to contact me about it.

| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 1 Jan 2013
Article Copyright 2011 by Dávid Kocsis
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid