###**======------==---=#%%@@%#*+--------==
        ###**=======---===---=%%@%###%%%#=------==
        ###*+=======-----=---%@@%#***#%@%%+------=
        ###*+========---==--+@@@#*****%@@@%=-----+
        ###*+=======----==--#@@%##*****#%@@#-:---+
        ###*+=======----==--#@@#*******+#@@%=----=
        ###*+=========--==--#@@***##**=+#%@%+---=+
        ###*+====-==-----=--+@@%***###**%@@%+---=+
        ###**====-==-----=---+@@@#******%@@@#*====
        #**#*=========--===--+#@@@%#***#%%%@##*===
        #*##*+=========-==--*@@@%%##****##%%%+::::
        #*#**+=========-:----=*==+++**##=+==-::-::
        

Jiayi (they/them)
carabinerr@proton.me
to neocities

<-- fasto

--> compiler

Game plan

Since the interpreter is built on F#, it makes sense to use F#'s own modules for implementing our concurrency model instead of building from scratch. In particular F# provides the MailboxProcessor class, which is built on top of its async programming model for asynchronous workflows.

So our task is to:

  1. First build the concurrency model in F# using MailboxProcessor.

  2. Then use that as a module for our interpreter.

  3. Finally we can define each expression (spawn, send, receive, channel and await) in the interpreter calling the respective functions from the module.

On MailboxProcessor and Async

Overall flow Concurrency.fs

Spawn

Await

Send

Receive

Channel

Testing results for Concurrency.fs

Integrating into Interpreter

problem with absyn referencing concurrency

Actual implementations

Spawn

Await

Send

Receive

Channel

Final results