Compiler into OISC languageLast update Notes on making Higher Subleq Try it online
Higher Subleq is a simplified typeless C language. It supports the C function call model and statement and expression grammar. It does not support structs, unions, bitfields, abstract declarations, and any types. There is only one type integer, which sintacticly can be wrtten as int, char or void and their pointers. It does not have preprocessor. It supports pointer arithmetic, but all pointers are just the same basic type. It also has a few C++ ticks:
The compiler and the emulator can handle bignum arithmetics. The following program calculates the factorial (use option -b for bugnum arithmetic since 20! is greater than 4 byte integer)
Multiplication operations are realized through the algorithm based on subtractions [O(logN)].
Below are examples of the commands:
> hsq file.hsq (compile and run) > hsq -a file.hsq (produces assembly code) > hsq -q file.asq (produces subleq code) > hsq file.sq (run subleq) > hsq file.asq (compile assembly and run) > hsq -ao file.asq (compile and output to stdout) > hsq -ha file (compile as hsq and save assembly) > cat file.hsq | hsq.exe -iao | hsq -imqo | hsq -is (piped)
Usage: hsq [options] [files] options: -e execute/emulate (defalut) -q output subleq code -a output assebmly -d output ITR -h
See also Low Cost Subleq Supercomputer