Skip to content

Instantly share code, notes, and snippets.

@noureddin
Last active December 13, 2020 21:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noureddin/26707b17d8bcde1529f16cea62f9dcde to your computer and use it in GitHub Desktop.
Save noureddin/26707b17d8bcde1529f16cea62f9dcde to your computer and use it in GitHub Desktop.
Compiling Kalimat IDE using Qt5 (on GNU/Linux), and Resources for Kalimat

Compiling Kalimat IDE using Qt5 (on GNU/Linux), and Resources for Kalimat

Most of the work is already done by Adham Zahran, but still, there are some needed fixes.

Here's what to do.

  1. Install Qt 5 (and preferably QtCreator too).

  2. Install libffi (sudo apt install libffi-dev on Debian/Ubuntu).

  3. Clone the repo

    git clone --depth 1 https://gitlab.com/lordadamson/kalimat
    cd kalimat
    
  4. Fix the transition from QtGui to QtWidgets:

    echo 'QT += widgets' >> kalimat/kalimat.pro
    sed -i 's/<QtGui/<QtWidgets/' kalimat/main.cpp
    
  5. Change assert in smallvm to something else:

    sed -i 's/assert/_ASSERT_/g' $(grep assert -r smallvm -l | grep -P '\.cpp$|\.h$')
    
  6. Fix ‫ارجع ب:‬: the lexer doesn't understand this, apparently because it's three tokens; maybe something during the development of the English Kalimat made this error slip, anyway: we can "fix" it by simply modifying it into a single token. I suggest أرجع (with an Alef with Hamza above), that's the correct spelling, but as everywhere else in the language all these verbs (that should start with an Alef with Hamza above) start with a normal, bald Alef, I reluctantly suggest modifying it to ارجع instead (which is the imperative of the intransitive verb, instead of the transitive one), so... forget all that and do the following command:

    sed -i 's/ ب://' kalimat/keywords.txt
    

    Now, in every example code, change ‫ارجع ب:‬ to just ارجع (i.e., remove ‫ب:‬).

  7. Open kalimat/kalimat.pro in QtCreator, configure, build, and run!

    Now you can copy (or symlink) the built kalimat binary into your $PATH.

  8. See these resources:

Notes to compile any example code you find:
  • change the single character to the three characters ....
  • change the occasional curly to a straight ASCII ".
  • change ‫طالما <شرط>:‬ to ‫كرر مادام <شرط>:‬, but ‫طالما صحيح:‬ to just ‫كرر:‬.
  • change every return-statement from ‫ارجع ب:‬ to just ارجع (i.e., remove ‫ب:‬). (See step 6 above.)
  • some other methods built-in methods are not defined at all.

Note about the screenshots: I input eastern Arabic numerals, and Kalimat understands them, but it always outputs western Arabic numeral.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment