cinera_handmade.network/pervognsen/bitwise/bitwise/bitwise043.hmml

38 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[video member=pervognsen stream_platform=twitch project=bitwise title="Domain-Specific Languages In Python" vod_platform=youtube id=4gJOiQbhWWM annotator=Miblo]
[0:09][Recap and set the stage for the day][:speech]
[0:34][Review some off-stream :optimisation on the lowered jump table-based switch statement][:asm :language :speech]
[5:30][Being careful of associativity when flattening expressions and register allocations, with another mention of the SethiUllman algorithm[ref
site=Wikipedia
page="SethiUllman algorithm"
url=https://en.wikipedia.org/wiki/Sethi%E2%80%93Ullman_algorithm]][:asm :language :speech]
[12:00][Setup to cover domain-specific languages in Python][:language :speech]
[15:46][Dive into building up an abstract syntax tree for our logic design code, starting by :parsing the & operator][:"data structure" :language]
[20:42][:Run it to find that it does execute][:language]
[21:11][Parse the | operator and introduce UnaryNode][:language :parsing]
[24:02][Note why __not__ doesn't exist in Python][:language :speech]
[25:11][Guard against erroneous boolean comparison of variables][:parsing]
[25:54][:Run it to see our intended error]
[27:50][Fix the \~ Node to use __invert__ (rather than __inv__)][:parsing]
[28:13][Note that we're building up a graph rather than a tree][:parsing :speech]
[30:43][Introduce the notion of a ConstantNode, and as_node()][:language :parsing]
[34:30][A few words on Python's reverse operator overload methods][:language :speech]
[38:18][Rename InputNode to VariableNode and input() to var()][:language :parsing]
[39:16][Consider how to handle out-of-range errors for bitwise-not in Python][:language :parsing :speech]
[44:12][Enable as_node() to handle out-of-range errors on ints by taking their least significant bit][:language]
[45:05][@elavid][I guess "1 & x" tries to run the int class __and__ function first, and when that throws some exception it tries Per's __rand__ function instead][:language]
[47:27][Determine to create a simple interpreter][:language :parsing :speech]
[49:09][Embark on a simple interpreter, introducing evaluate() and related functions][:language :parsing]
[57:02][Test evaluate() to see that it all works as expected][:language :parsing :run]
[1:01:28][Construct a nested tree 16 levels deep for evaluate() to evaluate][:language]
[1:06:33][:Run it to see that the :performance of our evaluate() is terrible, on 16 and 32 levels deep][:language :parsing]
[1:07:47][Introduce eval() to cache values for evaluate() to call][:language]
[1:12:15][:Run it to see that the state does get filled in][:language]
[1:12:41][Increase our nested tree to 32 levels deep][:language]
[1:13:19][:Run it to see that it is now instantaneous][:performance]
[1:14:51][Reflect on our Python-based interpreter][:speech]
[1:15:37][Q&A][:speech]
[1:15:47][@rickylqhan][What's your endgame?]
[1:17:11][@garryjohanson][@pervognsen So this is off-topic, but do you think the Intel 8086 chip will be within the direct scope of this project, or is it more complicated than what we are attempting?]
[1:18:17][That's it for today][:speech]
[/video]