Archive for May, 2007

Compiler issues 1

May 25, 2007 1 comment

Faced some problems with the construction of the compiler today.
The main one was: how to deal with code that may have backwards or cross-references, something like:

class A {
    def method1() {
        method2() // method2 hasn't been declared yet...

    def method2(){
        // where's self.x?
        // Down there, yeah, you know
        // but the compiler doesn't!
        print self.x 

        print B()
    def x

class B {
    def B() {
        print "inside B"

I looked for documentation and then remembered that there’s a lot of articles and documents about the Green Language, by Professor José Guimarães that should be useful, and really was.
This one in particular is exactly what I was looking for.

Basically, there’s more than one way to solve the above issue. And I chose to follow Guimarães’ advice and use the same method as him. Got interested in more details? Take a look at his articles or contact me.

It’s 2:00 AM and I’ve gotta work tomorrow today! Better take a rest and sleep a little! Cya!

Categories: English, Jeez, Programming

Tabs, spaces, curly braces and blocks

May 23, 2007 2 comments

Quick and small update concerning JBoia desing: decided to go with curly braces instead of identation for block delimiters.
Three reasons:

1) Tab width isn’t a standard, and it can get confusing when a single source-code file is edited by more than one person, who may not use the same editor. [ 1 & 2 ] ;

2) After reading Gaucho‘s commentary and the link he recommended, I though that curly braces are more popular and should make people already familiar with languages like C/C++, C# and Java more comfortable;

3) Yeah, also, I’ve gotta admit: it will be way easier to implement the compiler using curly braces instead of identation.

Categories: English, Jeez, Programming

A New Project

May 23, 2007 3 comments

I’ve been thinking of a small project to do, and trying to think of something new, I completely forgot about an old project that I always wanted to do, but never had enough time.

It’s a new programming language.
Yes, I know there’s plenty of them around, but these are things I like to do: creating new tools to make people’s life easier _and_ dealing with languages. Also, as the ‘best programming language ever’ subject is such a reason for discussions and, in my opinion, a matter of taste, I decided to make the language that suits my taste.

I’m working on its grammar. It’s not very complex by now, but should get more complex as the development goes further. I can say that I’m trying to mix things of languages I like. The syntax will probably be very Python-like. I’m also trying to get some things from Java. That’s why I’ve been calling the language JBoia, but it will probably have a little of C++ flavour.

I decided to write the posts about it in English because:
1) I need to practice my English (so, sorry for any mistakes);
2) I expect to receive commentaries and suggestions about the language design from people interested in the subject, and English is the language that most people know….

Some details about the language?
- It should be tab-oriented, as Python;
- It should be dynamic and strong typed, as Python;
- It should have strong visibility modifiers, as C++ and Java;
- Classes should be allowed to have static variables and methods;
- Classes’ instance variables should be explicitly declared;
- Will probably have multiple-inheritance;
- I want it to have operator overloading as well, but I don’t know if I’ll be able to do that :|
- I don’t have plans on building an interpreter or compile machine code (at least not yet). I’m creating a compiler that should compile JBoia to Java or C code, haven’t decided which one to use yet.
- I’m opened to suggestions, any of above could change with good reasons.

Although I like it very much and it’s by far the most interesting area of computer science in my opinion, I’m not an expert in language design. That’s why I’m looking forward to different commentaries and suggestions to help me on creating the best language I can.

class Cat:
            def name
            def age
            def kittens

            def static catCount = 0

            def Cat(name="Mimi", age=1, kittens=[]):
         = name
                  self.age = age
                  self.kittens = kittens
                  catCount += 1

            def getKittens():
                  return kittens

            def addKitten(cat):
                  if type(cat) == Cat:

            def getName():
                  return name

            def static howManyCats():
                  return catCount

      c1 = Cat("Nana", 2, [])
      c2 = Cat()
      print c1.getKittens()[0].getName()
      print Cat.howManyCats()

Should result in:

Categories: English, Jeez, Programming

Get every new post delivered to your Inbox.