Boost Spirit experimentation
Written by Mooneer Salem on Saturday 25th of December, 2010 in General with 3 comments
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. :)
Comments
If it is easier to maintain, then who cares about a few seconds of compile time and a couple of extra MB?
Not sure about maintainability yet. There’s still a lot of things not finalized with the new code. As for exact timings so far:
harry:kite-llvm mooneer$ time ./kite
...
Executing code…
42
real 0m0.150s
user 0m0.083s
sys 0m0.010s
harry:kite-llvm mooneer$
How the fundip do i contact you? I am having the hardest time finding any email or a way to ask questions about the code. I have some code i am working on and i made a “complex” (not really) structure of 3 classes and i need some help understanding why it wont work. Theres no reason for it not to work but its giving me errors. I don’t want to get into it, but i would like to contact who ever to get some help.