The Forth Lisp Python Continuum (Flpc) is a small high dynamic programming language I'm making. In these series of posts, I will describe and discuss its inner workings, more or less in the order that they are run when the program starts. This will hopefully help with others making programming languages and serve as some kind of documentation. Though Flpc was designed to be relatively easy to…
Just-in-time programming is a workflow for creating a program top-down, while a program is running. This is typical in Smalltalk environments like Squeak . In this post, I want to describe an instruction level variant of this. I think the best way to describe instruction level just-in-time programming (IL-JIT programming) is by showing how it works. I'll start with the classic Fibonacci example (…
A foreign function interface (FFI) is a way for one language to call functions from another language. The most common FFIs are C FFIs where the target language is C. I just pushed a new version of Flpc where I added a very limited FFI for calling Python. Highlights of some other changes are:
I wrote the Forth Lisp Python Continuum (Flpc)'s self hosted compiler in stages. When I completed the parser and gave it larger and larger pieces of its own source code, it was running too slow. I tried many things to speed it up, one that helped was using hash tables. They helped make dictionaries [names] which can An example of a dictionary:
The Forth Lisp Python Continuum (Flpc) can now compile its own source code! Get it from Github . So instead of $ python compiler.py file1.flpc file2.flpc file3.flpc > output.f you can now run $ ./flpc precompiled/compiler.f > push: output.f init_g > push: file1.flpc compile_file > push: file2.flpc compile_file > push: file3.flpc compile_file
Sikuli is a tool for automating repetitive tasks. To automate a program, it makes use of screenshots and image recognition to decide where to click and type [automation_methods]. As you can see above, Sikuli uses Python for its script's language (plus rendered image). But under the hood, its implemented in Java and runs Jython. Since nothing Sikuli uses really needs Java, we'll try to implement…
Nand to Tetris is a course that teaches you how to build a computer up from nand gates and then program Tetris for your computer. Nand game cover the first 3 projects of the course using a nice drag-and-drop interface Nand game includes a number of (in my opinion) improvements to the presentation. I feel it really lets me get to the crux of the matter quickly. This post contains solutions to Nand…
This continues a series where we make a debugger and live editor for (re)creating assembly and C programs. In part 1 , we got the assembly parts: read/write registers and memory, single step, single instruction execution, function calls (although not perfect), set/restore breakpoints, memory allocation and examining upcoming instructions. In part 2 , we got the C parts: read/write variables using…
Last time , we started making a debugger and live editor for (re)creating assembly and C programs. We got all the assembly parts: read/write registers and memory, single step, single instruction execution, function calls (although not perfect), set/restore breakpoints, memory allocation and examining upcoming instructions. This post will try to do similar things in the C portion. Next time, we'll…
gdb and lldb are the best known debuggers to me. While they are both customizable with scripts, there are many times where I'd like have much more control over how my debugger works (both the interactive portion and its internal representation). Being able to recreate flpc in a more interactive ways is one of these times. In this post, I try to make a debugger from more primitive pieces: the…
Flipbooks provide the simplest of animation and the basic principle remain the same with computers. Display a sequence of images fast enough and the eye perceives motion. In this post, I want to look at possible architectures and APIs for an animations library (to potentially be used with Make these slides or plain guitktk ).
There are many computer programs I'd like to use and modify that do not exist. In this post, I put forth the idea of a (different?) kind of collaboration to achieve this that I've had for a while now. Trades Basically, the idea is to coordinate with a group where each person makes one program and when we are all done, the union contains many programs that each person wants.
I've been making projects avaible on Github for a while now. The last one was guitktk . What I didn't say much about is that all the repositories are intended to form one big project. (Most of them also have uses on their own.)
Updating a rectangular bounding box of a selection was a bit of a hack in guitktk : every frame the selection was checked for changes and the rectangle recreated if needed. In this post, I'll show how to remove that check using "formulas" for parameter values.
Update : This post got many good comments and useful answers summarized at the very end. Or rather, are there any widely used implementations of a popular-enough language that directly interpret ASTs (or similar)? [1] Anything that doesn't compile to assembly to bytecode would do.
I use the Python interpreter interactively and pdb (as well as ipdb ) a lot and they let me understand my programs' state and test new things out quickly. When writing Flpc in C, I found it a difficult to transition. In this post, I describe how to use gdb to get a similar workflow.
This stackoverflow answer [1] shows how to add an until statement to Python. In this post I will show how to do that in python_terp and how to debug these modifications.
Direct link to the final (pregenerated) interpreter at the end of this tutorial . Try running nasm -f elf64 forth.asm -o forth.o ;and ld forth.o ;and ./a.out < test2.f inside forth22 .
With the major part of Forth written in Forth, we can now them in "Forth-style" assembly (using call / ret ). We will still have to write all the primitive functions in assembly.
Which came first? The chicken or the egg? This post discusses bootstrapping: the first step when trying to make something new. Bootstrapping is needed in many places.
A step is missing between pymetaterp , the (eventual) Python-like interpreter, and tkui the self modifying GUI editor: a GUI toolkit. Tkinter fills that role right now.
I finally changed pyzdb to support multiple servers. Actually, multiple read servers with a single write server. This post discusses the design and implementation selected. The pyzdb README now contains an example of how to use it.
There are many interesting things about python's sort function like how its adapts depending on the input, how its stable in-place, how its in other languages and how it could give the wrong result . This post is about none of those.