Labels

Wednesday, October 16, 2013

Wesley Wednesday 01: Things to Expect

My name is Wesley, I do stuff sometimes.

I'm a crappy Programmer who makes crappy games in his spare time as a feeble attempt to remove the word 'crappy' from his title. My name is Wesley, and I will post here on Wednesdays. Though you will probably read this on Thursday.

I write primarily in python, and I am learning Java.

Over the last week, I gave an attempt at writing a programming language interpreter.
I gave my language the most creative title, WesleysProgrammingLanguage or WPL.
I will share, once I eventually have a github working.

The language is very simple. You can do awesome things like display words or integers, and sometimes (if your feeling extra spontaneous), words and integers. Technology these days sure is marvelous.

I will go into depth after the break.


Sample code:

,.+*"*+.,,.+*"*+.,,.+*"*+.,,.+*"*+.,,.+*"*+.,
author -> " Wesley Wooten "

x -> 0
xplus : x -> x + 1 ;

while x < 100
disp x
disp 100 - x + " more to go! "
xplus
end

disp " " disp " "
D!
,.+*"*+.,,.+*"*+.,,.+*"*+.,,.+*"*+.,,.+*"*+.,

Note: squiggly lines are not required for WPL code. But it probably wouldn't break it either.

We have here...
     ->
     Sets a variable. x -> y sets x to the value of y

     disp
     displays the next token

     while
     repeats lines of code until the line 'end'

     functions
     the line "xplus : x -> x + 1 ;" adds one to the value of x.

     D!
     displays everything the user defined.

Running this code will output:
_______________________________
|| 0
|| 100 more to go!
|| 1
|| 99 more to go!
|| 2
|| 98 more to go!
|| (...)
|| 99
|| 1 more to go!
|| 100
|| 0 more to go!
||_______________________________

The full documentation is here: http://pastebin.com/fmkTRmxp
Interpreter (in Python 3) is here: http://pastebin.com/Qxz7NnHF
This also works as a pseudo-IDE (Interactive Development Environment, for all you non-code people)
Write code into this: http://pastebin.com/cCpVrHc8

I will be posting updates as I go, if you write something funky in my language or have any questions, or maybe you just want to tell me that I write code like a moron, leave a comment or something.

Until next week,
     -Wesley

No comments:

Post a Comment