-
In English code, we often like to combine multiple words when naming something in our code. This precision is sometimes necessary because naming is important, and hard! If you’re not convinced, read Tom Benner’s “Naming Things, The Hardest Problem in Software Engineering”. But, most programming languages don’t allow spaces in variable names, because lexers and…
-
Arithmetic in Python is pretty easy, right. For example, just add numbers: 5 + 3 8 But, just try this with numbers in other languages, like Arabic (it’s the same operation as above: 5 + 3): ۵ + ۳ Cell In[3], line 1 ۵ + ۳ ^ SyntaxError: invalid character ‘۵’ (U+06F5) Oh no! Python…
-
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…
-
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…
-
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…
-
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…
-
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…
-
I have to retool my Arabic BASIC interpreter, but in which compilable language should I use to implement the lexer, tokenizer and parser?
-
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…
-
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…