Wednesday, October 30, 2013



My team was awarded 3rd place on the first Bus Hackathon of the city of São Paulo! We had 28 hours to develop an application that could help SPTrans gather more valuable data on the public transportation of the city. Our application, inSPorte (short for "Inspetor do Transporte" or Transport Inspector), allows citizens to evaluate the public transportation services through questionnaires, and receive data about the current status of the public transport system (both buses and the subway). This application is not yet complete and has some flaws (28 hours is not enough time for something like this), but you can fork our project on GitHub if you wish! We've developed both Android and iOS versions, and also a Web Service, and a Web Portal.

On the media:

Sunday, August 25, 2013

Frost! v.0.1.5

Frost project is not dead! I am now working in an IT company here in Brazil, so I don't have as much free time as I had before to work on this project... But still, here's a new version!

This language is now capable of reflection! You can inspect your global variables (using a special variable called globalList) and your functions (using functionList), and you can also insert code at runtime (using the :: operator).

I hope you like it!

Sunday, August 4, 2013

Frost! v.0.1.3

A new version of the Frost programming language interpreter is now available, again! :-)

This new version supports named array positions. With this you can define structs and objects as arrays!

var stack = {

    .sp 0,
    .data {nil},

    .push ^:[d, stack] {[stack.sp] = d;
        stack.sp = stack.sp + 1;

    .pop ^:stack {

        if(stack.sp == 0) {

        stack.sp = stack.sp - 1;

    .isEmpty ^:stack {
        return (stack.sp == 0);

Stack object!

// Using this stack object

// Push an integer
[~stack.push stack:stack d:10];

// Push a string
[~stack.push stack:stack d:"Hello!\n"];

// Push a function
[~stack.push stack:stack d:@main];

// Pop everything and then print...
var d;

while(![~stack.isEmpty stack:stack]) {

    d = [~stack.pop stack:stack].string;
    [print string:"%s\n" format:{d}];


Thursday, July 25, 2013

Frost! v.0.1.2

Added "for each" loop! :-)

New echo example.

"Database" example.

EDIT: Pseudo Object-Oriented example:

// ...

main:args {

   var polygons = {
      [newTriangle pointA:{0, 0} pointB:{5, 0} pointC:{0, 5}],
      [newTriangle pointA:{0, 0} pointB:{2, 0} pointC:{0, 2}],
      [newCircle centre:{0, 0} radius:10.0],
      [newTriangle pointA:{0, 0} pointB:{3, 0} pointC:{0, 4}],
      [newCircle centre:{2, 2} radius:5.0],
      [newSquare pointA:{0, 0} pointB:{2, 0} pointC:{2, 2} pointD:{0, 2}]

   foreach(p in polygons) {
      [print string:"Perimeter: %v\n" format:{[polygonPerimeter polygon:p]}];
      [print string:"Area: %v\n\n" format:{[polygonArea polygon:p]}];

Download complete example!

Tuesday, July 23, 2013

Frost! v.0.1.1

A new version of the Frost Programming Language interpreter is now available! Now it is possible to create function pointers (or function references), call a function referenced by a variable or an array, and it is possible to create Blocks (just like Objective-C Blocks but with a different syntax)!


This generic bubble-sort can receive an array of any type of data to sort, as long as you provide it with a "compare" function capable of comparing these types of data.

How to create a function pointer?

var printPointer = @print;

// OR

var someFunctions = {@print, @scanInt};
How to create a block?

var a = ^ { [print string:"I am a Block!\n" format:{}]; };

// OR

const b = ^:a {
    [print string:"I am another Block... \'a\' equals %v\n" format:{a}];

// OR

var arrayOfBlocks = {
    ^{ [print string:"First!\n" format:{}]; },
    ^{ [print string:"Second!\n" format:{}]; },
    ^{ [print string:"Third!\n" format:{}]; }

How to call a block or a function referenced by a variable?

[~printPointer string:"Hello!\n" format:{}];

[~someFunctions[0] string:"Hello again!\n" format:{}];

[~b a:5];

var i;
for(i = 0; i < arrayOfBlocks.length; i = i + 1) {

Thursday, July 18, 2013

Why not a new programming language?

Hello World!

In the past few days I've been programming (in my spare time) a new programming language interpreter! This new interpreter is a refactored and improved version of the Ceres programming language interpreter, though the programming language syntax is not the same as before and this new interpreter is written in C whereas the other one was written in C++ and used STL. This time I'm calling the programming language Frost, first because I like cold weather, and second because the name of my previous interpreted programming language (Ceres) was the name of the goddess of agriculture and, as you might know, frosts can destroy entire crops, so a good name for a stronger successor would be one that could totally replace (or eliminate) the previous one (just like the frost over the crops).

But then you are gonna ask: why are you doing this?

One reason is because I felt that my previous interpreter was a complete failure and I wanted to create something better that could have practical uses. Another reason is because I really liked some of the characteristics of Objective-C, so I wanted to create something with some of these characteristics (named function parameters especially).

Echo, echo, echo....

Now you ask: what's special about this new programming language of yours?

Well, nothing yet. Theoretically you can write any program that you could write in C, but using my language. This language is very different from C, but it has the same basic functionalities (i.e. you can: define structs, use arrays, use control flow statements, ...), and some extra functionalities (implicit memory allocation, garbage collection through automatic reference counting, dynamically typed variables, attributes, ...). As any other major interpreted language, you can create bindings of your C functions to the interpreted program.

Here you can see a "generic" stack. This stack can receive any type of data.
In this case, it has received some matrices.

One advantage of this new programming language is that it makes it easy to define some data structures such as graphs, sets, trees, stacks, and matrices. You don't even need to specify your structure, all you need to do is create a hierarchy of arrays (you don't even need to specify the length of these arrays, though it is much more efficient if you do so). You also don't need to worry about memory allocation and deallocation, as it is done automatically for you (I still need to test it for memory leaks and "segmentation faults", but it should work well, especially if you don't have "reference loops" in your data topology).

Creating a simple binary tree...

const left = 0, right = 1;


main:args {


var root = {nil, nil}; // Root node
var childNodeLeft = {nil, nil}, childNodeRight = {nil, nil};

root[left] = childNodeLeft;
root[right] = childNodeRight;

root[left][left] = 0;
root[left][right] = 1;
root[right][left] = 2;
root[right][right] = 3;


Or, if you prefer...
var root = {{0, 1}, {2, 3}}; // Root node

You can add more levels...
var root = {{{0, 1},{2, 3}}, {{4, 5}, {6, 7}}};

Those leaf-nodes could have different types of variables...
var root = {{{'a', "Hello"},{2.5, 3}}, {{nil, {'H','E','L','L','O'}}, {-6, 7}}};

This possibility of having any type of variable in your leaf-node can be very useful because once you have programmed your own "binary-tree" library, you can use it with any type of data.

Interesting, where can I download it?

This project is available for download on SourceForge. Before downloading, note that this new language is still very young (it is almost two-weeks old) and it hasn't been properly tested nor it has some useful libraries (as of version 0.1, there is only one library: libIO that has some very simple functions for input/output).

This interpreter should compile on any POSIX system (I only used libc and posix system calls), but I only tested it on Mac OS X 10.8.4 (Darwin 12.4.0), and on Ubuntu 12.10 (Linux 3.5) and the included Makefile will only work on these systems.

Also note that I don't use efficient data structures for the internal variable and function handling (I only use linked lists), so this interpreter can run potentially slow if you have too many variables or functions in your program. I am about to improve these data structures as soon as I have time to do it...

If you plan to use this new language, note that its grammar is right-recursive (I know, it shouldn't be, but it is... I did not use Yacc to create a left-recursive grammar, I created my own recursive descent parser instead).


 - New interpreted programming language!
 - Interpreter written in C.
 - Structured programming language (Object-Oriented in the future)
 - Dynamically typed variables, garbage collection, attributes, named parameters, easy to create graphs and trees, ...
 - Still beta, might run slow, compiles on Linux and OS X.


Monday, July 1, 2013

RayTracer for iOS! [5th version]

This new version has some performance improvements, I recommend you to download it instead of the others (it will run much faster than the previous version).

I am about to publish this app on the official Apple App Store, so I would like to hear some feedback from you before I do that. Thank you!

 + HUGE performance improvements!
 + Bug fixes.


Friday, June 28, 2013

RayTracer for iOS! [4th version: Multi-thread + iPad]

A new version of my RayTracer is available for iOS! Now it has a multi-threaded renderer (it might run faster on your device), and iPad is now supported.

It is also possible to create images with a user-defined dimension (bigger or smaller than the screen).

Monday, June 24, 2013

RayTracer for iOS! [new version!]

Now it is possible to edit the scene file inside the app! I hope you like it...

UPDATE: New version: Now it is possible to save your resulting image! iTunes File-Sharing is now enabled too!

Friday, June 14, 2013

RayTracer for iOS!

After one night of work (from 11 pm to 4 am), I finally ported my RayTracer to iOS! This version of my RayTracer is still very incomplete and there's still a lot of work to do (mainly in the user interface), but I am still learning how to program in Objective-C (I only watched 4 classes of that online iOS course from Stanford University), so I think porting this program is a good start for me!



iPad version coming soon! There are some performance issues to be dealt with before I can release this version...

Tuesday, June 11, 2013

Some of my work for University - Part 1

As I approach the end of my Computer Science course, I will post some of the work I did for university. Feel free to reuse some of my code (for academic purposes ONLY!), but remember to give me credit for it (citing my name and a reference to this blog would be nice :-) ).

Ceres Shell (University of São Paulo - Operating Systems II - 2011)

Description: Simple shell program similar to sh, with Ceres programming language as its script language.
OS: Linux, and OS X.
Requires: -
Language: Portuguese

RollerCoaster (Dalhousie University - Computer Animation - 2012)

Description: Roller coaster simulator programmed in C with OpenGL (uses Uniform B-Spline curves for the roller coaster generation).
OS: Linux, and OS X.
Requires: GLUT (OpenGL)
Language: English

Physics (Physically based animation) (Dalhousie University - Advanced Computer Animation - 2013)

Description: Physically based animation programmed in C with OpenGL (using quaternions, laws of motion, and numerical integration).
OS: Linux, and OS X.
Requires: GLUT (OpenGL),  LAPACK, and BLAS.
Language: English

I will post more soon, I hope you like it!

P.S.: I moved back to Brazil after 8 months living in Canada!