Kite Programming Language

On a tangent

Written by Mooneer Salem on Thursday 29th of December, 2011 in Usage

harry:kite-llvm mooneer$ ./kite
class X [
    method z() [
        true;
    ];
    method y() [
        (make System.exceptions.NotImplemented())|throw;
    ];
];

v = make X();
v|y;
^D
System.exceptions.NotImplemented: Exception thrown
    in method X|y + 0xcc
    in (main program) + 0xfd

harry:kite-llvm mooneer$

Notice anything different? Hint: the exception trace looks a lot nicer. :)

Long overdue update!

Written by Mooneer Salem on Saturday 11th of June, 2011 in General

Hi everyone! I know I havent updated in a while, but Ive had life go on since my last update. I was able to get back to working on the LLVM port of Kite, though, so I implemented a few things:

  1. I moved kitellvm development to a Git repository. This is mostly an experiment to see how it goes. I like it so far, though.
  2. Implemented basic exceptions in kitellvm (no stack trace yet):
    harry:kite-llvm mooneer$ ./kite
    run 
    [ 
        (make this.System.exceptions.exception())|throw; 
    ] 
    catch 
    [
        __exc.message|print; 
    ];
    ^D
    Exception thrown
    harry:kite-llvm mooneer$ 
  3. Implemented an ikt port:
    harry:kite-llvm mooneer$ ./ikt
    Interactive Kite console
    ikt> "hello world"|print;
    hello world
    ---> hello world
    ikt> ^D
    harry:kite-llvm mooneer$  
  4. Class definition and instantiation support:
    harry:kite-llvm mooneer$ ./kite
    class X
    [
        method __init__() [ this.elite = 1337; ];
    ];
    
    (make X()).elite|print;
    ^D
    1337
    harry:kite-llvm mooneer$  

Anyway, more updates soon :)

Boost Spirit experimentation

Written by Mooneer Salem on Saturday 25th of December, 2010 in General with 3 comments

Ive been playing with Boost Spirit as an alternative to Bison/Flex lately for Kite. So far, its actually pretty nice in terms of syntax; you only need to use C++ to describe your language. Ive already found a few disadvantages, as shown below:

harry:kite-llvm mooneer$ time sh compile.sh 
Compiling src/apps/kite.cpp...
Compiling src/codegen/llvm_compile_state.cpp...
Compiling src/codegen/llvm_node_codegen.cpp...
Compiling src/codegen/syntax_tree_node_printer.cpp...
Compiling src/codegen/syntax_tree_printer.cpp...
Compiling src/parser/parser.cpp...
Linking...

real    0m34.831s
user    0m32.598s
sys 0m2.048s
harry:kite-llvm mooneer$ ls -lh
total 12240
-rwxr-xr-x@ 1 mooneer  staff   238B Dec 25 00:42 compile.sh
-rwxr-xr-x  1 mooneer  staff   4.0M Dec 25 15:02 kite
-rw-r--r--  1 mooneer  staff   9.2K Dec 25 15:01 kite.o
-rw-r--r--  1 mooneer  staff    10K Dec 25 15:01 llvm_compile_state.o
-rw-r--r--  1 mooneer  staff    72K Dec 25 15:01 llvm_node_codegen.o
-rw-r--r--  1 mooneer  staff   1.8M Dec 25 15:02 parser.o
drwxr-xr-x  6 mooneer  staff   204B Dec 23 21:34 src
-rw-r--r--  1 mooneer  staff   5.7K Dec 25 15:01 syntax_tree_node_printer.o
-rw-r--r--  1 mooneer  staff   9.6K Dec 25 15:01 syntax_tree_printer.o
harry:kite-llvm mooneer$

(tl;dr: very large binaries, even with g++ Os, and very long compile times.) Ive only implemented the math operations so far for the above test.

Anyway, Ill put up the code when I have a bit more to show. :)

1.0.4 released

Written by Mooneer Salem on Tuesday 23rd of November, 2010 in Releases with 2 comments

Kite 1.0.4 has been released.

New in this release:

  • Internal data structures modified for performance and memory efficiency.
  • Added preliminary multiple inheritance support.

Download:

Issue tracker URL (for bug reports): http://trac.kitelanguage.org/report/1
Getting help: http://trac.kitelanguage.org/wiki/GettingHelp

Something fun to try

Written by Mooneer Salem on Wednesday 4th of August, 2010 in Usage

Today, I found out about a pretty nifty regular expression that will match if a number is not prime. Turns out that the regex is usable unmodified in Kite:

#!/usr/bin/kite

method is_prime(number)
[
    property rgx;
    property digit_str;
    rgx = r/^1?$|^(11+?)\1+$/;
    
    digit_str = "";
    until(number == 0)
    [
        digit_str = digit_str + "1";
        number = number - 1;
    ];
    (rgx|match(digit_str) is System.null);
];

(is_prime(17))|print;
(is_prime(3))|print;
(is_prime(20))|print;

Results:

true
true
false

Unfortunately, because of the way the regular expression engine in Kite works, it took much longer than 14 seconds to run the check for the large numbers tried in the article. This will be another facet of the overall Kite optimization effort in the future as well. :)