October 19, 2017 15:00:45
Boa Home
An ambassador is an honest man sent abroad to lie and intrigue for the benefit of his country. -- Sir Henry Wotton, 1568-1639

 .:  Boa
Introduction | History | Design | IDE | Download

Introduction

Boa is a language similar to Python. It's both interpreted and compiled, targetting the .NET framework. It includes three interfaces -- an embeddable .DLL, a command-line interactive shell/compiler, and a rudimentary IDE.

History

Through a long chain of events, this was inspired by my GameLib project. My previous C++ versions of GameLib had scripting support. However, for the current C# version, it seemed far less important, given that .NET can easily compile code at runtime. But unfortunately, none of the .NET languages were really elegant enough for scripting (JScript.NET comes close).

I looked around for an implementation of Python for .NET and didn't find anything good, so I started designing a language that was a superset of Python. It was Python with additional syntax to declare statically-typed variables, .NET attributes, .NET enums, etc. The classes created would be normal .NET classes, etc. The goal was for it to be a fully-integrated, compiled .NET language. This turned out to be very difficult to implement, however. For instance, Python allows multiple inheritance, while .NET only allows single inheritance.

Eventually, I gave up and once more looked around for a project that someone else had started. I found IronPython, which, according to the description on the website, was just what I needed! However, it didn't quite deliver on the promises it made (and the author updated the website to reflect that after I emailed him). It was also quite buggy in some areas, and a lot of newer Python features were unimplemented. I waited with hope for new releases, however, but none came. So eventually, I scrapped my old project and started work on Boa. The internal design shares some similarities with IronPython, as I was able to learn some new tricks by reading the IronPython code. Unfortunately, the high ideal of having it integrate seamlessly into .NET was tossed aside. But on the other hand, Boa already works and can run a lot of Python code. In fact, I've been able to use libraries from Python unchanged, which is certainly speeding the development of the Boa standard library.

Design

Boa is not quite Python, having some slightly different syntax and semantics. I also haven't tried to maintain backwards compatibility with old versions of Python (for instance, old-style classes and deprecated APIs are not being implemented). But most Python code runs with little or no changes, assuming the appropriate libraries are there.

At least, it did, until the development of the IDE. Since that point, strict compatibility with Python has become a lower priority, as it seems better to simply make the language as good as possible. At this point, I'm not sure whether I should continue striving for Python compliance, or just branch off and make all the changes to Boa that I feel would be worthwhile. I added a few additional constructs, such as named blocks and jumps, a ternary operator, and some constructs to aid writing .NET code, such as C#-style lock and using statements. Boa also has "real" closures, whereas Python has simplified, read-only closures.

It's still essentially Python, but I'm not sure where I'll take it from here.

IDE




(older screenshot)

I began work on a simple IDE, because I found existing Python IDEs to be insufficient. The primary flaw, I thought, was that the modes for editing a source file and for immediate evaluation were not integrated enough. In Emacs Lisp, you can write a function and, with a single keystroke, compile the function into the execution environment. Then, you can immediately test it, either from the source file window or another window. Essentially, you can press a key to evaluate any expression, including declarations. This provides a very fast edit/test cycle. I've tried to recreate this with the Boa IDE.

Unfortunately, the IDE is not documented. Specifically, there are a number of undocumented keyboard commands to do autocompletion, code evaluation, object help (showing docstrings and/or function signatures), window switching, etc. (Currently, you'll have to look at the source code to discover them all.) The IDE is also somewhat bare. It doesn't provide any support for project files or similar things. It provides "support" for compiling an executable, and many other features, but the lesser-important features are just stubbed out right now. However, it's still the best Python-like IDE I've seen, simply because of how tight the edit/test loop is. Each window contains its own execution frame, but the environment is shared. You can be editing a module in one window and an application that uses the module in another. The application window can do "import module" (where module is the name of the other file), and you'll get intellisense, autocompletion, etc between the two files.

I'll be improving the IDE as I use it more.

Download

The latest version of Boa can be downloaded here. An older and less sophisticated but more functional version is available here. Alternately, if you can't figure out how to build it from source but still want to try it out, feel free to contact me.

Copyright 2003-2016 Adam Milazzo. Verbatim copying and redistribution of this entire page are permitted without royalty in any medium provided this notice is preserved.