Programming


qhasm documentation

The qhasm programming language, although still in protoype status, is a powerful tool to help writing high-speed software. It is so far mostly documented by examples, so I wrote a Python script that generates an html-"documentation" for qhasm automatically from the qhasm machines description files. The documentation lists all currently supported instructions (qhasm version 20070207).


qhasm examples

For a very easy example of a qhasm program for the x86 architecture download add_x86.q and test_x86.c. The add function performs addition of two integer vectors, the code should be self-explanatory.
To build the program use

qhasm-x86 < add_x86.q > add_x86.s
gcc -o test add_x86.s test_x86.c

Magma syntax highlighting for vim

In order to make syntax highlighting for magma work in vim download magma.vim, copy the file to ~/.vim/syntax/ and activate it in vim by entering

:set syntax=magma

If you want to automatically load the magma syntax highlighting for .mag files create the ~/.vim/filetype.vim with the following content:
" my filetype file
if exists("did_load_filetypes")
finish
endif

augroup filetypedetect
au! BufRead,BufNewFile *.mag  setfiletype magma
augroup END