Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

Firebasic

A compiler for my own peculiar programming language that resembles Visual Basic, but has support for lower-level features such as pointers. It uses another project of mine, NIR, to convert code into an intermediate representation, which is optimized and then dealt with by individual backends.

Requirements:

  • nasm (for assembling x64 code)
  • gcc (for linking the object files together)

Usage:

firebasic <input files | flags> <output file>
Flags: /win (passes -mwindows to linker)

Example program

' Random number generator in Firebasic' nokiiaa, 2022ConstNULLAsVoid*=0DeclareFunctionLib"user32.dll"MessageBoxA(hWndasVoid*,lpTextasChar*,lpCaptionasChar*,uTypeasUInteger)AsIntegerFunctionRand(stateAsUInteger*)AsUIntegerDimxAsUInteger=*statex=xXor(x<<13)x=xXor(x>>17)x=xXor(x<<5)*state=xreturnxEndFunctionSubItoa(nAsInteger,outputAsChar*)DimdigitsAsInteger=0DimiAsInteger=0DimnumberAsInteger=nWhilenumberdigits+=1number/=10EndWhileoutput(digits)=0Whileni+=1output(digits-i)=nMod10+0x30n/=10EndWhileEndSubFunctionMainAsIntegerDimstateAsUInteger=244DimmessageAsChar*="Your random number: __________."WhileTrueItoa(Rand(&state)Mod1000,message+20)MessageBoxA(NULL,message,"Here it is! (wow)",0)EndWhileReturn0EndFunction

About

A compiler for a Visual Basic-like programming language with low-level features

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages