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. :)
Written by Mooneer Salem on Saturday 11th of June, 2011 in General
Hi everyone! I know I haven’t updated in a while, but I’ve 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:
- I moved kite–llvm development to a Git repository. This is mostly an experiment to see how it goes. I like it so far, though.
- Implemented basic exceptions in kite–llvm (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$
- 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$
- 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 :)
I’ve been playing with Boost Spirit as an alternative to Bison/Flex lately for Kite. So far, it’s actually pretty nice in terms of syntax; you only need to use C++ to describe your language. I’ve 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.) I’ve only implemented the math operations so far for the above test.
Anyway, I’ll put up the code when I have a bit more to show. :)
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.
- Source: http://www.kite–language.org/files/kite–1.0.4.tar.gz
- kdoc documentation: http://www.kite–language.org/docs/kdoc–1.0.4/ (as tarball)
- General Kite documentation: http://www.kite–language.org/docs/kite–1.0.4–docs/ (as tarball)
- Kite API documentation: http://www.kite–language.org/docs/kite–1.0.4–api–docs/ (as tarball)
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;
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. :)