freebasic.net Forum Index
FreeBASIC's Official Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in

freeLOLcode - LOLcode.com implementation for freebasic
Goto page 1, 2  Next
 
Post new topic   Reply to topic    freebasic.net Forum Index -> Projects
View previous topic :: View next topic  
Author Message
sir_mud
Master
PostPosted: Sep 12, 2007 17:03    Post subject: freeLOLcode - LOLcode.com implementation for freebasic Reply with quote

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:

'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
 
Back to top
View user's profile Visit poster's website
attacke

PostPosted: Sep 12, 2007 17:53    Post subject: Reply with quote

omg! raly funni! not gonna test it tho, just read it and had some giggles. nice idea.
 
Back to top
View user's profile Visit poster's website
Imortis
Master
PostPosted: Sep 12, 2007 17:56    Post subject: Reply with quote

I'm disturbed and intrigued all at once...
 
Back to top
View user's profile Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Pritchard
Guru
PostPosted: Sep 12, 2007 17:57    Post subject: Reply with quote

This is just lovely.
 
Back to top
View user's profile Send e-mail
badmrbox
Sr. Member
PostPosted: Sep 12, 2007 17:58    Post subject: Reply with quote

I'm gonna flip over and faint.
 
Back to top
View user's profile Visit poster's website
jevans4949
Master
PostPosted: Sep 12, 2007 20:42    Post subject: Reply with quote

Kewl!

Might as well give up on Freebasic now!
 
Back to top
View user's profile Send e-mail
notthecheatr
Master
PostPosted: Sep 12, 2007 22:49    Post subject: Reply with quote

What the FFFFFFFUUUUUU....?

BrainF*** is better. Also HQ9+, which is apparently capable of executing any standard example program plus OOP.
 
Back to top
View user's profile Send e-mail Visit poster's website
v1ctor
Site Admin
PostPosted: Sep 13, 2007 3:33    Post subject: Reply with quote

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

I remember that kind of competition at the #freebasic IRC channel, good times..
 
Back to top
View user's profile Visit poster's website MSN Messenger
sir_mud
Master
PostPosted: Sep 13, 2007 7:51    Post subject: Reply with quote

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
 
Back to top
View user's profile Visit poster's website
Dr_D
Hero
PostPosted: Sep 13, 2007 8:28    Post subject: Reply with quote

-lang lol? lol
 
Back to top
View user's profile Visit poster's website
yetifoot
Master
PostPosted: Sep 13, 2007 8:47    Post subject: Reply with quote

THIS IS WITCHCRAFT, BURN HIM!
 
Back to top
View user's profile Visit poster's website
KristopherWindsor
Hero
PostPosted: Sep 13, 2007 17:30    Post subject: Reply with quote

Ha ha, I just saw your ASCII art - nice! :-)
 
Back to top
View user's profile Send e-mail Visit poster's website
sir_mud
Master
PostPosted: Sep 13, 2007 18:03    Post subject: Reply with quote

its not my ascii art, found it online somewhere and just pasted it in
 
Back to top
View user's profile Visit poster's website
sir_mud
Master
PostPosted: Sep 13, 2007 21:06    Post subject: Reply with quote

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:

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:

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
 
Back to top
View user's profile Visit poster's website
sir_mud
Master
PostPosted: Sep 14, 2007 4:46    Post subject: Reply with quote

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
 
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    freebasic.net Forum Index -> Projects All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



sf.net phatcode