Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Boa Programming Language

8 views
Skip to first unread message

Curtis W

unread,
Jul 11, 2008, 12:05:19 PM7/11/08
to
http://home.comcast.net/~cwarren89/boa.zip


Boa is a programming language I designed a few years back. It was
heavily inspired by python, although there are quite a few
differences. Essentially, I took out all the parts I didn't like and
added stuff I wanted. The only thing I never got around to doing was
writing a type checker for it. At the time I was waiting until I
started on the compiler, but I never got around to it. (I should point
out that, when I say 'type checker,' I mean one that essentially acts
as a lint-equivalent. It would only warn you--it wouldn't stop
compilation.)


*******************************
EXAMPLES
*******************************

guess.boa
*******************************
def main():
number = random([0..1000])
for chance in [0..10]:
guess = readline("guess: ").to_int()
if guess == number:
print("You got it\n")
return
elif guess > number:
print("Too high\n")
elif guess < number:
print("Too low\n")
print("Uh-oh, you ran out of time\n")


data.boa
*******************************
data Person:
name:list # editor's note: I can't remember if I ever implemented a
parametric list type
age:int

def main():
people = [Person("Rick", 25), Person("Tom", 21), Person("Sue", 32)]
for person in people:
print("%s: %s\n" % [person.name, person.age])
for person in people:
person.age *= 2
for person in people:
print("%s: %s\n" % [person.name, person.age])


parametric.boa
*******************************
def main():
even(2)
even(4)
# even(5) would fail

type Even(t) = t where (x => x%2 == 0)

def even(x:Even(int)):
print("%d is even\n" % [x])

*******************************
README
*******************************

THIS IS NOT A USABLE INTERPRETER. It's something I hacked together in
the span of about a month, and it's probably some of the worst code
I've ever written.

With that out of the way, most things should work decently. IIRC, the
only thing I didn't completely finish was the type constraints
checker, but for all intents and purposes it should function normally.
All of the examples in examples/ should work. To run one of them just
`python boa.py examples/whatever.boa`. To run all of them, do:

chmod u+x all boa.py
./all

Don't bother trying to pipe the output anywhere, since one of the
examples is an interactive guess-the-number game.

LICENSE:

IANAL, but as far as I know I should be able to release this to the
public domain. The files lex.py and yacc.py come from PLY, which is
LGPL, but you could just as easily swap those out with a replacement
if you wanted. I don't really care what you do with the code that's
mine, though, but I don't claim responsibility for anything that might
go wrong because you decided to use something this poorly coded.


And no, I'm not even going to bother proofreading this README. If you
see a spelling or grammar error, keep it to yourself.


Copyright (c) 2006 Curtis Warren

Bruce C. Baker

unread,
Jul 11, 2008, 5:18:19 PM7/11/08
to

"Curtis W" <cwar...@gmail.com> wrote in message
news:c70eec58-b115-42b8...@x41g2000hsb.googlegroups.com...

You post demonstrates precisely why I've shied away from learning python:
significant white space. Your posted examples seem to have lost all trace of
theirs, although the examples in the .zip file seem to have retained their
indentation.


Curtis W

unread,
Jul 11, 2008, 7:03:59 PM7/11/08
to
On Jul 11, 4:18 pm, "Bruce C. Baker" <b...@undisclosedlocation.net>
wrote:
> "Curtis W" <cwarre...@gmail.com> wrote in message

Whoops. It was probably when I copied and pasted them into the textbox
in google groups. Even still, it could've been worse. You could've had
to deal with braces soup along with no indentation ;)

(on the other hand, if you /really/ wanted to minimize transmission
errors, you could always use XML as a syntax.)

Curtis W

unread,
Jul 11, 2008, 7:09:06 PM7/11/08
to

Actually, I take that back. The indentation looks fine on my end.

Curtis W

unread,
Jul 11, 2008, 7:58:41 PM7/11/08
to
On Jul 11, 11:05 am, Curtis W <cwarre...@gmail.com> wrote:
> http://home.comcast.net/~cwarren89/boa.zip

It occurs to me that sticking a link in a usenet post isn't the
greatest way to keep something available. If it's possible, could
somebody reply to this thread with the zip file as an attachment? I
can't seem to do it with google groups.

Mensanator

unread,
Jul 11, 2008, 8:13:05 PM7/11/08
to
On Jul 11, 6:03 pm, Curtis W <cwarre...@gmail.com> wrote:

That's not it. They read fine in Goggle Groups. Someone is
probably using a crappy newsreader.

Significant whitespace is the greatest thing since sliced bread.

> Even still, it could've been worse. You could've had
> to deal with braces soup along with no indentation ;)
>
> (on the other hand, if you /really/ wanted to minimize transmission

> errors, you could always use XML as a syntax.)- Hide quoted text -
>
> - Show quoted text -

Harold Aptroot

unread,
Jul 11, 2008, 8:55:51 PM7/11/08
to
"Curtis W" <cwar...@gmail.com> wrote in message
news:eba6ec80-3dc5-458b...@k30g2000hse.googlegroups.com...
<snip>

> Actually, I take that back. The indentation looks fine on my end.
</snip>

I don't see any indentation there..

CBFalconer

unread,
Jul 11, 2008, 8:34:40 PM7/11/08
to
Curtis W wrote:
>
> It occurs to me that sticking a link in a usenet post isn't the
> greatest way to keep something available. If it's possible, could
> somebody reply to this thread with the zip file as an attachment?
> I can't seem to do it with google groups.

Two faults here. One is top-posting. Please don't. The other is
trying to attach binary things to usenet messages. That is also
bad. In many cases the various news portals will simply drop the
entire mess. You can always put a link in a usenet post - if the
google anomalies (google is a terrible usenet server) annoy you,
get a proper newsreader and a suitable server. There are many free
ones.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.


Curtis W

unread,
Jul 11, 2008, 11:19:36 PM7/11/08
to

Noted.

Thanks for the speedy reply.

0 new messages