Uncategorized

  • In my ArabicBASIC interpreter I started out with a single symbol table which actually performed several roles: storing symbols and their associated values. The first role is indeed the symbol table’s role, but the second really belongs to the concept of scope. Scope not only keeps track of a symbol’s value, it also tracks where

    Read more →

  • In the middle of writing my interpreter for ArabicBASIC, I was testing the expression grammar. I accidentally forgot a parenthesis which gave me an expression like “LET A = ((2 + 3) * 4“. Notice how the parentheses are mismatched: the final one after the 4 is missing. This should have provoked an error, but

    Read more →

  • I was adding to my list of prior art for my ArabicBASIC project last week when I encountered a new-to-me project which implements a Javascript-like language in Pakistan’s national language, Urdu. This immediately caught my attention because Urdu is traditionally written in a modified Arabic alphabet. This language is appropriately called UrduScript and it runs

    Read more →

  • Writing grammars in BNF is actually kind of fun! Conforming to specifications is not. Let me explain: It’s possible to write grammars with trees of rules, some of which don’t actually do much other than to eventually create grouping nodes in the parse tree. ECMA-116 is just one such rabbit-hole grammar, I’d say: That’s very

    Read more →

  • Last time I promised that I would reveal my interpreter’s implementation language. And, here it is: Java. I chose Java for several reasons. The first reason is because Java is what ANTLR4 itself is written in. Secondly, the Java runtime library used by the generated tokenizer and parser gets new features first. I get the

    Read more →

  • Internally, it’s called PyList_Append and it returns an integer, which is used as a success vs. failure flag. But for now, let’s skip going down that rabbit hole, and instead focus on how it adds an element to a List. We can see that the real work seems to be done by app1() (1) which

    Read more →

  • I’ve used Strawberry Perl on my Windows XP and Windows 7 dev rigs for several years now. It includes MingW to compile C code in any CPAN modules which use it for speedups. Some CPAN modules will not install without it if they do not have pure-Perl (PP) versions. Now, about Python. Recently, I began

    Read more →

  • First Try I started with a simple while loop: Surely, this is non-optimal: how many times will this loop run? 1000? Surely we can reduce it! Possible optimizations include: Start at 3 instead of 0! Surely we can skip numbers if we do find a multiple of 3 or 5? That is, keep adding 3

    Read more →

  • Here I am coding up some exercises in my first love of a language, Perl (Its the CPAN, I tell you). In my console, I kept getting a strange result: Hi Fred! You are the first one here! 1 Hi Barney! I’ve also seen Fred here! 2 Hi Wilma! I’ve also seen Fredand Barney here!

    Read more →

  • Sometimes, MySQL start-up errors aren’t accurate. If its driving you crazy, just run sudo mysqld on the command line to find out what’s really the problem. In my case, I had updated some settings in my development server’s /etc/my.cnf. After a long while, I rebooted and lo and behold, MySQL refused to start. /var/log/mysql/error.log said

    Read more →