
    
    
        
        
                
        
        
        
                
        
        
        
                
        
        
        
            
{"version":"https:\/\/jsonfeed.org\/version\/1","title":"mathspp.com feed","home_page_url":"https:\/\/mathspp.com\/blog\/tags\/lsbasi-apl","feed_url":"https:\/\/mathspp.com\/blog\/tags\/lsbasi-apl.json","description":"Stay up-to-date with the articles on mathematics and programming that get published to mathspp.com.","author":{"name":"Rodrigo Gir\u00e3o Serr\u00e3o"},"items":[{"title":"Let&#039;s build a simple interpreter for APL - part 4","date_published":"2021-04-03T00:00:00+02:00","id":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part4","url":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part4","content_html":"<p>In part 4 of this series we add some unit testing,\nimprove our tokenizer and implement the primitives <code>&#9076;<\/code> and <code>&#9060;<\/code>.<\/p>\n\n<p>In the previous post I said I would be making less changes in between each blog post\nto make the blog posts smaller, but now I went back to check the changes I had\nto write about and I realised I did <em>way<\/em> too much to fit in a single blog post...<\/p>\n<p>So while RGSPL v0.4 is out, I'm going to split it in a couple of blog posts.\nYou can see all the changes from v0.3 to v0.4 <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/compare\/v0.3...v0.4\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">here<\/a>.<\/p>\n<h2 id=\"today\">Today<a href=\"#today\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>The RGSPL v0.4 is essentially v0.3 plus the exercises of the previous blog post,\nand that represents plenty of changes and additions to our code base.\nIn this article we will only cover a few:<\/p>\n<ul><li>add testing for the primitives I already have;<\/li>\n<li>tokenizer tweaks and fixes;<\/li>\n<li>tweaking the CLI to accept a flag to toggle debugging;<\/li>\n<li>implement the shape and reshape functions (monadic and dyadic <code>&#9076;<\/code>); and<\/li>\n<li>implement the atop operator <code>&#9060;<\/code>.<\/li>\n<\/ul><h3 id=\"next-time\">Next time<a href=\"#next-time\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h3>\n<p>Here are the changes we still have to go through in the next blog posts.<\/p>\n<ul><li>\n<p>add class methods to deal with the n-cells of APL arrays and others;<\/p>\n<\/li>\n<li>\n<p>homogenise the representation of APL scalars;<\/p>\n<\/li>\n<li>\n<p>modify the <em>index generator<\/em> <code>&#9075;<\/code> function to make a distinction between 1-item vectors and scalars;<\/p>\n<\/li>\n<li>\n<p>modify the <em>without<\/em> <code>~<\/code> function to work on the major cells of the left argument;<\/p>\n<\/li>\n<li>\n<p>implement pretty printing of APL arrays;<\/p>\n<\/li>\n<li>\n<p>add auxiliary decorators that do input checking;<\/p>\n<\/li>\n<li>\n<p>implement the Boolean functions <code>&and;&or;&#9074;&#9073;<\/code>;<\/p>\n<\/li>\n<li>\n<p>implement the encode and decode functions <code>&#8868;&perp;<\/code>;<\/p>\n<\/li>\n<\/ul><h3 id=\"the-code\">The code<a href=\"#the-code\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h3>\n<p><a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link image\">\n  <img src=\"https:\/\/img.shields.io\/github\/stars\/RojerGS\/RGSPL?style=social\" alt=\"\"><\/a><\/p>\n<p>The whole code for this project is hosted in <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">this<\/a> GitHub repo\nand the code for this specific blog post is <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/releases\/tag\/v0.4\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">the release v0.4<\/a>.<\/p>\n<p><a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/compare\/v0.3...v0.4\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">This link<\/a> shows the diff with all the changes that happened since v0.3.<\/p>\n<hr><h2 id=\"testing\">Testing<a href=\"#testing\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>Unit testing is a really important thing for several reasons, for example\nit provides an automated way to test your code\n(and therefore gives you confidence that your code works as expected) and\nit helps you figure out when code refactoring broke something.\nIf you also start by writing the unit testing for a certain feature and only\nthen implement the feature, you are forced to write code that passes your tests,\ninstead of writing tests that your code passes.<\/p>\n<p>I don't have much experience with unit testing in Python so I went\nto look for a simple alternative in the Python Standard Library and found <code>unittest<\/code>,\nso that is what I am using.<\/p>\n<p>I figured I would be writing many more tests than the ones we wrote in the\nprevious blog post, so I decided to create a directory for the tests and created\na <code>tests\/utils.py<\/code> file with some utility functions:<\/p>\n<pre><code class=\"language-py\">\"\"\"\nUtility functions used by the tests.\n\"\"\"\n\nimport functools\nimport unittest\n\nfrom rgspl import Interpreter, Parser, Tokenizer\nfrom arraymodel import APLArray\n\ndef run(code):\n    \"\"\"Run a string containing APL code.\"\"\"\n    return Interpreter(Parser(Tokenizer(code))).interpret()\n\ndef S(scalar):...<\/code><\/pre>","date_modified":"2025-07-23T16:49:02+02:00","tags":["apl","interpreters","lsbasi-apl","programming","python"],"image":"\/user\/pages\/02.blog\/lsbasi-apl-part4\/thumbnail.webp"},{"title":"Let&#039;s build a simple interpreter for APL - part 3 - the array model","date_published":"2020-10-08T00:00:00+02:00","id":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part3","url":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part3","content_html":"<p>In this blog post we will go over some significant changes, from implementing APL's array model to introducing dyadic operators!<\/p>\n\n<h2 id=\"recap\">Recap<a href=\"#recap\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>In the last two blog posts we wrote a simple Python program that tokenizes basic <a href=\"https:\/\/aplwiki.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">APL<\/a> expressions, then parses and interprets them. We introduced some functions, like <code>+-&times;&divide;<\/code> and the operator <code>&#9064;<\/code>.<\/p>\n<p>The program from <a href=\"\/blog\/lsbasi-apl-part2\">part 2<\/a> takes an expression like <code>5 6 -&#9064; &divide;1 2<\/code> and then turns it<\/p>\n<ul><li>into a list of tokens like <code>[Token(EOF, None), Token(INTEGER, 5), Token(INTEGER, 6), Token(MINUS, -), Token(COMMUTE, &#9064;), Token(DIVIDE, &divide;), Token(INTEGER, 1), Token(INTEGER, 2)]<\/code>\n<\/li>\n<li>then into an AST like <code>MOp(&#9064; Dyad(- A([S(5), S(6)]) Monad(&divide; A([S(1), S(2)]))))<\/code>\n<\/li>\n<li>and finally evaluates it to <code>&macr;4 &macr;5.5<\/code>.<\/li>\n<\/ul><h2 id=\"today\">Today<a href=\"#today\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>Today we are going to:<\/p>\n<ol><li>implement the APL array model properly;<\/li>\n<li>introduce dyadic operators;<\/li>\n<li>implement more functions and operators;<\/li>\n<li>introduce a testing script to check the implementations are working correctly.<\/li>\n<\/ol><p>Also, from now on I want to reduce the time between consecutive posts so I will write blog posts after less changes to the interpreter.\nThis will also mean the posts become smaller and easier to read.<\/p>\n<h3 id=\"the-code\">The code<a href=\"#the-code\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h3>\n<p><a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link image\">\n  <img src=\"https:\/\/img.shields.io\/github\/stars\/RojerGS\/RGSPL?style=social\" alt=\"\"><\/a><\/p>\n<p>The whole code for this project is hosted in <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">this<\/a> GitHub repo and the code for this specific blog post is <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/releases\/tag\/v0.3\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">this release<\/a>.<\/p>\n<p><a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/compare\/v0.2...v0.3\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">This link<\/a> has the diff with all the changes that happened since the last post.<\/p>\n<hr><p>Now that we got this out of the way, let's dive right into the changes for today. You can follow <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/compare\/v0.2...v0.3\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">this link<\/a> to see literally <em>every single change<\/em> that happened since the last post.<\/p>\n<p>Let us start with simpler changes like introducing complex numbers, allowing for variable names to contain digits, a couple of helper methods in our parser and moving functions\/monadic operators\/dyadic operators to their own files to keep everything sort of organised.<\/p>\n<h2 id=\"simpler-changes\">Simpler changes<a href=\"#simpler-changes\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<h3 id=\"updated-grammar\">Updated grammar<a href=\"#updated-grammar\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h3>\n<p>We needed to update our grammar to include dyadic operators (introduced today!), complex numbers and some new functions and operators.\nHere is how the grammar looks now:<\/p>\n<pre><code class=\"language-py\">    program        ::= EOF statement_list\n    statement_list ::= (statement \"&#8900;\")* statement\n    statement      ::= ( ID \"&larr;\" | vector function | function )* vector\n    function       ::= function mop | function dop f | f\n    dop            ::= \"&#8728;\" | \"&#9061;\"\n    mop            ::= \"&#9064;\" | \"&uml;\"\n    f              ::= \"+\" | \"-\" | \"&times;\" | \"&divide;\" | \"&lceil;\" | \"&lfloor;\" |\n                     | \"&#8866;\" | \"&#8867;\" | \"&#9075;\" | \"&lt;\" | \"&le;\" | \"=\" |\n                     | \"&ge;\" | \"&gt;\" | \"&ne;\" | \"~\" | \"&sub;\" | LPARENS function RPARENS\n    vector         ::= vector* ( scalar | ( LPARENS statement RPARENS ) )\n    scalar         ::= INTEGER | FLOAT | COMPLEX | ID<\/code><\/pre>\n<p>The changes to the grammar will be explained in the relevant sections of this post.\nThe most notable changes are the addition of the <code>COMPLEX<\/code> token to the <code>scalar<\/code> rule, the inclusion of <code>dop<\/code>s in the <code>function<\/code> rule and the new <code>dop<\/code> rule itself, and the renaming of the <code>array<\/code> rule to <code>vector<\/code>.<\/p>\n<h3 id=\"variable-names-can-contain-digits\">Variable names can contain digits<a href=\"#variable-names-can-contain-digits\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h3>\n<p>In APL variable names can contain plenty of interesting...<\/p>","summary":"In the third instalment of this series we write a proper implementation of the APL array model","date_modified":"2025-07-23T16:49:02+02:00","tags":["apl","programming","python","interpreters","lsbasi-apl"],"image":"\/user\/pages\/02.blog\/lsbasi-apl-part3\/cube.webp"},{"title":"Let&#039;s build a simple interpreter for APL - part 2","date_published":"2020-06-19T00:00:00+02:00","id":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part2","url":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part2","content_html":"<p>Today is the day! Today is the day we take our <a href=\"https:\/\/aplwiki.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">APL<\/a> programs and interpret them, so that something like <code>&divide; 1 2 3 -&#9064; 1.1 2.2 3.3<\/code> can output <code>10 5 3.33333333<\/code>.<\/p>\n\n<p><img src=\"\/blog\/lsbasi-apl-part2\/.\/lsbasi-apl-part2-bg.webp\" alt=\"A black and white doodle of a person in front of a computer.\"><\/p>\n<p>Just to get us started, here are two ASTs, two Awfully Sketched Trees.<\/p>\n<h2 id=\"recap\">Recap<a href=\"#recap\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>If you recall, in the <a href=\"https:\/\/mathspp.com\/blog\/lsbasi-apl-part1\">last blog post<\/a> of the series (which was also the first!) we created a simple program that took a basic <a href=\"https:\/\/aplwiki.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">APL<\/a> expression (APL is a really cool array-oriented programming language), tokenized it and then parsed it into an AST, an Abstract Syntax Tree.<\/p>\n<p>With that program, we can turn an expression like <code>5 6 -&#9064; &divide;1 2<\/code><\/p>\n<ul><li>into a list of tokens like <code>[Token(EOF, None), Token(INTEGER, 5), Token(INTEGER, 6), Token(MINUS, -), Token(COMMUTE, &#9064;), Token(DIVIDE, &divide;), Token(INTEGER, 1), Token(INTEGER, 2)]<\/code>\n<\/li>\n<li>and into an AST like <code>MOp(&#9064; Dyad(- A([S(5), S(6)]) Monad(&divide; A([S(1), S(2)]))))<\/code>\n<\/li>\n<\/ul><h2 id=\"today\">Today<a href=\"#today\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>Today we are going to:<\/p>\n<ol><li>implement assignment of scalars\/arrays;<\/li>\n<li>allow for several statements split by <code>&#8900;<\/code>;<\/li>\n<li>implement the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Visitor_pattern\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Visitor pattern<\/a> to interpret an AST and produce the final result. You can check <a href=\"https:\/\/ruslanspivak.com\/lsbasi-part8\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Spivak's 8th post<\/a> to see how he did it.<\/li>\n<\/ol><p>(writing this list was easy, I just went to the previous blog post and copied the list of things we would get done for today!)<\/p>\n<p>Additionaly, to make the above changes easier to implement, I am also going to redesign some of the things that were already done. Please don't be mad at me! Quoting my previous post,<\/p>\n<blockquote>\n<p><em>\"By the way, this might be a great moment to let you know that I make mistakes! Lots of them!\"<\/em><\/p>\n<\/blockquote>\n<p>So we are actually starting with refactoring the parser and the way we represent monadic\/dyadic function application. I decided to make this change when I realized implementing all the APL <a href=\"https:\/\/aplwiki.com\/wiki\/Operator\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">operators<\/a> was going to be a real headache with the format I chose before.<\/p>\n<p>To make my changes easier to understand, we will study the AST generated for the simple expression <code>1 +&#9064;&#9064; 2<\/code>. If you test it,\nthe program will print <code>MOp(&#9064; MOp(&#9064; Dyad(+ S(1) S(2))))<\/code>, which can be drawn as:<\/p>\n<p><img src=\"\/blog\/lsbasi-apl-part2\/.\/old_parser_dyadic_example.webp\" alt=\"Sketch of the AST generated for the example expression.\"><\/p>\n<p>What I don't like about this AST is that I don't know if the operator <code>&#9064;<\/code> is acting on a monadic or dyadic function until I reach the bottom of the tree, where I have my function and my two arguments. If you type the same expression <code>1 +&#9064;&#9064; 2<\/code> in the new parser, the output printed is a list with the single element <code>Dyad(MOp(&#9064; MOp(&#9064; F(+))) S(1) S(2))<\/code> in it; this tree can be represented as:<\/p>\n<p><img src=\"\/blog\/lsbasi-apl-part2\/.\/new_parser_dyadic_example.webp\" alt=\"Sketch of the new AST generated for the example expression.\"><\/p>\n<p>With the new tree I have clearly separated the issue of finding the function I will apply from the arguments to which the function will be applied. I am also guessing this will make it easier to later implement things like <a href=\"https:\/\/aplwiki.com\/wiki\/Tacit_programming#Trains\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">trains<\/a> and assigning functions to variables.<\/p>\n<p>I challenge you to modify the AST nodes and the parser yourself to produce trees like these for dyadic function applications. Monadic function application undergoes a similar...<\/p>","summary":"In this post we enhance our interpreter to handle multiple expressions and to evaluate them.","date_modified":"2025-07-23T16:49:02+02:00","tags":["apl","programming","python","interpreters","lsbasi-apl"],"image":"\/user\/pages\/02.blog\/lsbasi-apl-part2\/lsbasi-apl-part2-bg.webp"},{"title":"Let&#039;s build a simple interpreter for APL - part 1","date_published":"2020-05-13T00:00:00+02:00","id":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part1","url":"https:\/\/mathspp.com\/blog\/lsbasi-apl-part1","content_html":"<p>Let's build a simple <a href=\"https:\/\/aplwiki.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">APL<\/a> interpreter! APL is an array-oriented programming language I picked up recently. The ease with which I can write code related to mathematics, its strange built-ins (which look like <code>&#9076;<\/code>, <code>&#9064;<\/code>, <code>&#9042;<\/code> or <code>&#9059;<\/code>) and the fact that it is executed from right to left make it a fresh learning experience!<\/p>\n\n<p><img src=\"\/blog\/lsbasi-apl-part1\/.\/lsbasi-apl-part1-bg.webp\" alt=\"A black and white doodle of a person in front of a computer.\"><\/p>\n<h2 id=\"foreword\">Foreword<a href=\"#foreword\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>First and foremost, let me give credit to Ruslan Spivak's <a href=\"https:\/\/ruslanspivak.com\/lsbasi-part1\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Let's build a simple interpreter<\/a> blog post series on building a Pascal interpreter. I first read the beginning of the series a couple of years ago and ended up <a href=\"https:\/\/mathspp.com\/blog\/creating-programming-language-from-scratch\">creating the Roj programming language<\/a>; this time I am going over the series again but with the purpose of building an interpreter for APL which is fairly distinct from Pascal.<\/p>\n<p>I am writing an APL interpreter and writing about it because<\/p>\n<ul><li>it will help me learn APL;<\/li>\n<li>I get to flex my Python skills and improve them;<\/li>\n<li>I get to document what I did in order to get my code working;<\/li>\n<li>I get to help you write your own APL interpreter if you decide to do so!<\/li>\n<\/ul><p>For those of you who know the LSBASI series, the numbering in my LSBASI series is <em>not<\/em> going to match Spivak's. This is because in this interpreter I need to worry about things Spivak did not have to and vice-versa, because APL and Pascal have so distinct characteristics in some aspects. On the other hand, the beginning is fairly similar and this post will present work that matches roughly what Spivak has by halfway of his <a href=\"https:\/\/ruslanspivak.com\/lsbasi-part8\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">8th blog post<\/a>.<\/p>\n<h3 id=\"the-code\">The code<a href=\"#the-code\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h3>\n<p><a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link image\">\n  <img src=\"https:\/\/img.shields.io\/github\/stars\/RojerGS\/RGSPL?style=social\" alt=\"\"><\/a><\/p>\n<p>The code for this project is available at <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">this GitHub repo<\/a> so go ahead and star it ;) The source code for this part is just the <a href=\"https:\/\/github.com\/RodrigoGiraoSerrao\/RGSPL\/releases\/v0.1\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">rgspl1.py<\/a> file: you can download it in order to try it out.<\/p>\n<h2 id=\"what-we-are-aiming-for\">What we are aiming for<a href=\"#what-we-are-aiming-for\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>This blog post series will follow along my journey of building an APL interpreter and that is the end goal! To have a fully functional APL interpreter written in Python! That is going to be a lot of work ;)<\/p>\n<h2 id=\"today-s-goal\">Today's goal<a href=\"#today-s-goal\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>In this blog post we will go through the basics to kickstart this project; in particular, we want to be able to parse simple APL statements with:<\/p>\n<ol><li>floats and integers (positive and negative - in APL <a href=\"https:\/\/aplwiki.com\/wiki\/High_minus\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">we use <code>&macr;<\/code> to negate a number<\/a>, e.g. <code>&macr;3<\/code> is <span class=\"mathjax mathjax--inline\">\\(-3\\)<\/span>) and vectors of those;<\/li>\n<li>monadic and dyadic versions of the functions <code>+-&times;&divide;<\/code>;<\/li>\n<li>the <em>commute\/switch<\/em> operator <code>&#9064;<\/code>;<\/li>\n<li>parenthesized expressions;<\/li>\n<\/ol><h2 id=\"tokenizing\">Tokenizing<a href=\"#tokenizing\" class=\"toc-anchor after\" data-anchor-icon=\"#\" aria-label=\"Anchor\"><\/a><\/h2>\n<p>The first thing we need to do is take some APL source code and split it into tokens, getting rid of things we don't need - like whitespace - and finding what each character represents. For example, we look for numbers and decide if those are integers or floats or look at APL glyphs and attach them to their names.<\/p>\n<p>This is the code for the <code>Token<\/code> class that defines the several types of tokens we...<\/p>","summary":"The first post on a series about an APL interpreter written in Python","date_modified":"2025-07-23T16:49:02+02:00","tags":["apl","programming","python","interpreters","lsbasi-apl"],"image":"\/user\/pages\/02.blog\/lsbasi-apl-part1\/lsbasi-apl-part1-bg.webp"}]}
