My newest invention: The Glas Language (A Pythonic offshot)
5 points| bhdz | 12 years ago
#!/usr/bin/env glas
print: "Welcome to Glas language"
Person:
name: last:"Random" & first: "Joe" & fathers: "Someone"
# name = {'last':"Random", "first": "Joe", "fathers": "Someone" }
print: person's name # print(person.name)
print: person's name's last # print(person.name.last)
print: last' person's name
arguments = alpha, beta, gamma
function application: *arguments
a, b, c = 1, 2, 3
calc discriminant: a, b, c # calc_discriminant(a,b,c)
# Glas doesn't care much about ','
calc discriminant: a b c # Same as before
call discriminant: top segment, b, c
# If it sees ',' it combines
# all that is listed & adds it to current
# first param and moves on to the
# next one with "," (switches modes)
object's perform something:
quit:' my's company
kill yourself:' motherfreaker
kill:' and maim:' opponent
check dead:' kill: with pistol' and maim: blunt object' opponent
kill: with pistol' and maim: blunt object' opponent's check dead:
# And he walked through the valey of
# the shadows of death and he feared no evil
# he.and_walked(
# through: "valey of shadows of death")
# .and_feared(not("evil")
# )
and walked: "through the valey"' he's
and feared: not: "evil"
# Ideal for code poetry hackatons! :D
# Almost sounds like a real preacher, this Glas
and warneth: "of temptation"' thee's and ignoreth: me
# ahahahahahaa sorry 'bout that :)
my: last: "Random" & first: "Joe"
if len: my's last' name > 10:
print: "Your name is too big!"
Bank Clerk: Person:
initialize = my, name, job, salary, project:
# my.name = name ...
with my:
name, job, salary, project' do:
=: *project
start working: project
start slacking: "Doom3"
start working: project' my
receive payment: salary' my
if my's hours > 40:
complain: hours' my's boss
if my's salary < 1500:
complain: salary' my's boss
start slacking' my # Oh my!
Tell me what you think ;)~ ps: Glas means Voice in Bulgarian (Глас) or even Russian!
[+] [-] bhdz|12 years ago|reply
all: standard symbol set:
All these operators can be a different set, but these glyphs are the best in my opinion~ # PS: PLEASE do NOT get offended by my characterization
# of certain method calls as "homosexual"
#
# Don't! This is just for laughs at the language
# I am not against gay community in any way
# and "homosexual" calls are actually the most
# useful feature of this language
#
# Thank you.
[+] [-] bhdz|12 years ago|reply
[+] [-] bhdz|12 years ago|reply
[+] [-] bhdz|12 years ago|reply
[+] [-] bhdz|12 years ago|reply
[+] [-] bhdz|12 years ago|reply
so you write:
and this chains the needed things nicely in fact you can write like this:[+] [-] bhdz|12 years ago|reply
and that's much better than that.much better, don't you think?
[+] [-] bhdz|12 years ago|reply
[+] [-] lifeisstillgood|12 years ago|reply
my.name['last']
How does the ' operator decide between need for 's and not?
Where is the GitHub page? :-) What did you learn :-) Who are you ?
Nice one
[+] [-] bhdz|12 years ago|reply
I am planning on adding additional features like adding statements after each method call with the ':' operator, like this:
[+] [-] bhdz|12 years ago|reply
It doesn't care basically if it's encountering a dict ({}), an object, or a function/method.
If it's not a function then it's either a dict OR another object instance. it it's a function it applies it! Glas treats everything as potential functions or procedures (no arguments) math sin: x could be _anything_ really :)
Use '$' sign if you wish to refer to function's object explicitly like this:
[+] [-] bhdz|12 years ago|reply
[+] [-] bhdz|12 years ago|reply
I had some kind of a satori Saturday, so it's still just a glas.py file which aims are being a simple as possible translator into Python. (for now it just parses it and evals it like a barbarian, and still not workable ;))
I will make a repo later today, after work.