freeLOLcode - LOLcode.com implementation for freebasic

User projects written in or related to FreeBASIC.
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

freeLOLcode - LOLcode.com implementation for freebasic

Postby sir_mud » Sep 12, 2007 17:03

first, if you've never hear of lolcode head over to http://lolcode.com for a bit, I'll wait...




Back yet?
Ok, here ya go:
file: lolcode.bi

Code: Select all

'LOLcode for FreeBASIC version 1.02
'Not to be cornfuzzled with LOLcode version 1.0
'This supports somewhere between LOLcode version 1 and LOLcode version 1.2
'Copyright (c) 2007 Ebben Feagan (sir_mud)
'Licenced under the terms of the GNU General Public License

'General Section
#define CAN_HAS #include once
#define STDIO "lolcode.bi"
#define HAI declare sub main(): main(): sub main()
#define KTHXBYE end sub 'ends the program
#define BTW rem 'The real way to make a comment
#define BRB(x) sleep x
#define CANDLEJACK(x,y,z) mid(x,y,z)
#define EPIC_FAIL end

#macro HALP(x)
print "DO NOT WANT: " & #x
end 255
#endmacro

'Graphics
#define IT_CAN_BE_PRETY_PICTRS_TIEM_NOW screenres
#define CHEX_MAH_SKILZ glbegin 'Requires CAN_HAS "GL/gl.bi"
#define DEMS_TITE_RITE glend
#define GIT_MAH_PIX bload
#define HAS_MAH_PIX bsave
#define DOODL draw
#define DOT pset
#define UNDOT preset
#define MAH_LAZER line
#define A_MOUF circle
#define ITZ_MINE_NOW get
#define U_CAN_HAS put
#define FLIPN_MAH_LIDZ flip
#define SPLL_MAH_PANT paint
#define BUNCHA_KEYZ multikey
#define GETZ_DAT_MOUS getmouse
#define FORGETS cls


'Types, supporting private and public directives
#define THIS_SAMMICH_IS type
#define MINE_ONLY private:
#define I_SHAR_DEES public:
#define NO_MOAR_SAMMICH end type


'Subroutine - no return value
'O_HAI_IM must come before the HAI line
#define O_HAI_IM declare sub
#define HAI_IM sub
#define THXBYE end sub

'Function - returns a value
'O_HAI_U_HAS_A must come before the HAI line
'example function prototype: O_HAI_U_HAS_A two( foo as NUMBR ) I_GIEF NUMBR
#define O_HAI_U_HAS_A declare function
#define I_GIEF as
#define HAI_U_HAS_A function
#define HAR_YA_GO(x) return x
#define DONE_GIEFING end function

'Da Maths
#define UP +
#define UPZ +=
#define NERF -
#define NERFZ -=
#define TIEMZ *
#define TIEMZD *=
#define OVAR /
#define OVARD /=
#define LIEK = 'equality operator
#define R = 'assignment operator
#define LEFTOVER mod
#define BOOM ^
#define BOOMZ ^=
#define BIGR_THAN >
#define LES_THAN <
#define XORZ xor
#define ORZ or



'Variable creation::example: I_HAS_A longcat ITZ_A YARN ITZ "Longcat is long"
'or this: I_HAS_A tacgnol ITZ_A NUMBR ''dim tacgnol as integer
'continued: LOL tacgnol R 23 ''tacgnol = 23
#define I_HAS_A dim
#define BIG_OL shared
#define ITZ_A as
#define ITZ =
#define LOL let

'Variable types
#define NUMBR integer
#define BIG_NUMBER long
#define YARN string
#define NUMBAR single
#define BIG_NUMBAR double
#define TROOF byte
#define WATCHR ptr

'I/O
#define GIMMEH input
#define VISIBLE print
#define WIF using
#define GIMMEH_THAT open
#define I_WANNA for
#define REED_IT input
#define STROK_IT binary
#define WRIT_IT output
#define FINIS_IT append
#define PUT_IN as
#define MAH_MOUF #1
#define MAH_LEF_HAND #2
#define MAH_RITE_HAND #3
#define MAH_LEF_FEET #4
#define MAH_RITE_FEET #5
#define MAH_POOPR #6


'If...then...else...end if
#define IZ if
#define O_RLY then
#define YA_RLY REM
#define NOWAI else
#define KTHX end
#define IZ_K if

'Select...case
#define SRSLY_WHAT_IZ select case
#define MEBBE_ITZ case
#define WHATEVAR case else
#define OK_SRSLY end select

'Looping
#define IM_IN_YUR_LOOP do
#define TIL until
#define WILE while
#define GTFO exit
#define YUR_LOOP loop
#define IM_OUTTA_YUR_LOOP loop

'For...Next
#define OMG for
#define TOO to
#define WTF next

'True and False
#define WIN 1
#define FAIL 0

'Miscellaneous
#macro LET_ME_SHOW_YOU_MY_POKEMANS()
scope
randomize timer
dim as integer n
dim as integer MAXPKMN = 3
n = int(rnd(1)*MAXPKMN)
select case n
case 0
print "/----------------------------------------\"
print "|._                            _.-|      |"
print "||_~~`--._                 _.-~   /      |"
print "|  ~-._   ~-._.-~~~~~~~-.-~    _.~       |"
print "|      ~-._ /             \_.-~          |"
print "|          |  .-.   .-.   |              |"
print "|          |. |_| . |_|   |         __.-||"
print "|          /    .__,      |    _.--~    ||"
print "|          \             /_--~~  \     / |"
print "|          /~-._______.-~  \     |____|  |"
print "|         |  /         \    |        /   |"
print "|          ~|_       |_|_-~~        /    |"
print "|           | ~-\_/-~    |        _~     |"
print "|           |   |   |    /     _-~       |"
print "|            |  |  /    |__---~          |"
print "|            |,_|,_|____(                |"
print "|----------------------------------------|"
print "|              #113 Evee                 |"
print "\----------------------------------------/"
case 1
print "/---------------------------------------------\"
print "|.__                           __.            |"
print "| \ `\~~---..---~~~~~~--.---~~| /             |"
print "|  `~-.   `                   .~         _____|"
print "|      ~.                .--~~    .---~~~    /|"
print "|       / .-.      .-.      |  <~~        __/ |"
print "|      |  |_|      |_|       \  \     .--'    |"
print "|     /-.      -       .-.    |  \_   \_      |"
print "|     \-'   -..-..-    `-'    |    \__  \_    |"
print "|      `.                     |     _/  _/    |"
print "|        ~-                .,-\   _/  _/      |"
print "|       /                 -~~~~\ /_  /_       |"
print "|      |               /   |    \  \_  \_     |"
print "|      |   /          /   /      | _/  _/     |"
print "|      |  |          |   /    .,-|/  _/       |"
print "|      )__/           \_/    -~~~| _/         |"
print "|        \                      /  \          |"
print "|         |           |        /_---`         |"
print "|         \    .______|      ./               |"
print "|         (   /        \    /                 |"
print "|         `--'          /__/                  |"
print "|---------------------------------------------|"
print "|                #25 Pikachu                  |"
print "\---------------------------------------------/"
case else
print "/--------------------------------\"
print "|          ___                   |"
print "|     _.-~~   ~~~-.              |"
print "|    /         _   ~.            |"
print "|   |#`       /#`    \           |"
print "|   |-'|      |-'|    |          |"
print "|   /--        --     |-.        |"
print "|   \__   .  .        / /\_      |"
print "|    \ ~~--___---~~/\| |   ~-.   |"
print "| .---`~~--____---_)  \ \-__  \  |"
print "| ) <    |__    __\_   \ \     | |"
print "| ~-.__ /   ~~~~   \   \ \     | |"
print "|      ~-.   |     .~-.-' |    | |"
print "|       | \___|___/     / /     ||"
print "|       | /   |   \     | |  /  ||"
print "|        \     |   ~-___ \ \/  / |"
print "|        /\__ / `._ /   ~-\ \_/  |"
print "|       /    \_____|      |`~    |"
print "|      |      |    |      |      |"
print "|       \     |    |      |      |"
print "|       >______)   /_/\/\_\      |"
print "|--------------------------------|"
print "|          #7 Squirtle           |"
print "\--------------------------------/"
end select
end scope
#endmacro



Questions, comments, concerns can be posted here. Also discussion of yur pokemans. (as long as you has related stuffs too)

*edited*
Most recent version here always now, changelog in new posts.
KTHXBYE
Last edited by sir_mud on Sep 14, 2007 21:02, edited 1 time in total.
attacke
Posts: 55
Joined: Mar 19, 2006 11:57
Contact:

Postby attacke » Sep 12, 2007 17:53

omg! raly funni! not gonna test it tho, just read it and had some giggles. nice idea.
Imortis
Posts: 1289
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Postby Imortis » Sep 12, 2007 17:56

I'm disturbed and intrigued all at once...
Pritchard
Posts: 5418
Joined: Sep 12, 2005 20:06
Location: Ohio, USA

Postby Pritchard » Sep 12, 2007 17:57

This is just lovely.
badmrbox
Posts: 659
Joined: Oct 27, 2005 14:40
Location: Sweden
Contact:

Postby badmrbox » Sep 12, 2007 17:58

I'm gonna flip over and faint.
jevans4949
Posts: 1115
Joined: May 08, 2006 21:58
Location: Crewe, England

Postby jevans4949 » Sep 12, 2007 20:42

Kewl!

Might as well give up on Freebasic now!
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Postby notthecheatr » Sep 12, 2007 22:49

What the FFFFFFFUUUUUU....?

BrainF*** is better. Also HQ9+, which is apparently capable of executing any standard example program plus OOP.
v1ctor
Site Admin
Posts: 3794
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Sep 13, 2007 3:33

OMG, #defines are evil, see now? Time to remove them!

I remember that kind of competition at the #freebasic IRC channel, good times..
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

Postby sir_mud » Sep 13, 2007 7:51

well, i agree #define's aren't the most elegant way, but until I see a -lang lol option it'll have to do :p
Dr_D
Posts: 2342
Joined: May 27, 2005 4:59
Contact:

Postby Dr_D » Sep 13, 2007 8:28

-lang lol? lol
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Postby yetifoot » Sep 13, 2007 8:47

THIS IS WITCHCRAFT, BURN HIM!
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Postby KristopherWindsor » Sep 13, 2007 17:30

Ha ha, I just saw your ASCII art - nice! :-)
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

Postby sir_mud » Sep 13, 2007 18:03

its not my ascii art, found it online somewhere and just pasted it in
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

Postby sir_mud » Sep 13, 2007 21:06

Updated version.
Changelog:
Added SAMMICH, the type keyword. See Types comment for related keyword additions
Added File i/o, had to move even farther away from the spec again.

Examples-
freeLOLcode:

Code: Select all

BTW file i/o
GIMMEH_THAT "file.txt" I_WANNA REED_IT PUT_IN MAH_MOUF

BTW types
THIS_SAMMICH_IS good
I_HAS_A burger ITZ_A YARN
I_HAS_A lettus ITZ_A NUMBR
NO_MOAR_SAMMICH

freebasic:

Code: Select all

open "file.txt" for input as #1

type good
dim burger as string
dim lettus as integer
end type


newest lolcode.bi in first post.
Last edited by sir_mud on Sep 14, 2007 21:00, edited 1 time in total.
sir_mud
Posts: 1401
Joined: Jul 29, 2006 3:00
Location: US
Contact:

Postby sir_mud » Sep 14, 2007 4:46

New version: 1.02
changelog:
Added most graphics commands including a couple GL commands

see first post for lolcode.bi
Last edited by sir_mud on Sep 14, 2007 20:59, edited 1 time in total.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests