Trending

Latest Posts by Tyler (Jones Beach)

What did the train conductor ask the software engineer?

What time does the carriage return?

8 hours ago 1 0 0 0
Python snippet which includes both a runtime error and a syntax error.

Python snippet which includes both a runtime error and a syntax error.

pop quiz! what happens when you run this #python code?

(my friend got this wrong, and one Memphis engine does too 😂)

3 days ago 1 0 0 0

Only worked on Memphis for half an hour today, but I discovered a new abstraction and that's enough.

5 days ago 1 0 0 0

😂😂😂

now I want to make a runtime which requires all classes implement left shift (no default provided)

5 days ago 2 1 0 0

There's another optimization I should add, which is treating something like `(1,2)` as a compile-time constant, rather than something which must call `BUILD_TUPLE` at runtime.

1 week ago 0 0 0 0
Ozark bytecode explorer showing RETURN_VALUE opcode with multiple values passed via tuple.

Ozark bytecode explorer showing RETURN_VALUE opcode with multiple values passed via tuple.

And the second is a new behavior for RETURN_VALUE, it now supports multiple returns by compiling the values into a tuple.

1 week ago 0 0 1 0
Ozark bytecode explorer showing UNPACK_SEQUENCE n opcode.

Ozark bytecode explorer showing UNPACK_SEQUENCE n opcode.

Two new bytecode features!

The first is `UNPACK_SEQUENCE n`.

1 week ago 0 0 1 0
Advertisement

I should also wire this up to use `__str__` soon-ish, but I don't fully support dunder-overloading in my VM yet.

Not far away though, so maybe this will give me a nudge!

2 weeks ago 0 0 0 0

CPython does something a little fancier for format, since there are technically 3 modes. but I only support the default (str) right now.

2 weeks ago 0 0 0 1
Python bytecode showing an f-string expression.

Python bytecode showing an f-string expression.

Two new opcodes for f-strings! `FORMAT` and `BUILD_STRING n`.

2 weeks ago 1 0 0 1

This ended up being a simple but interesting fix.

I had accidentally registered two implementations of float.__sub__, when one of them was supposed to be float.__mul__.

3 weeks ago 0 0 0 0
Build Your First REST API in Rust workshop with the ACM at the City College of New York.

Build Your First REST API in Rust workshop with the ACM at the City College of New York.

Earlier this month, I led a "Build Your First REST API in Rust" workshop for the ACM at the City College of New York.

About 30 students attended, and we built a simple CRUD API together from scratch.

Grateful for the opportunity to be in the room!

3 weeks ago 0 1 0 0

Yikes!

memphis 0.1.0 REPL (engine: treewalk) (Type 'exit()' to quit)
>>> 4.1 - 3.01
12.340999999999998

4 weeks ago 0 0 0 1

There's a lot of magic behind:

`type(4) is int`

1 month ago 0 0 0 0
Python explorer showing tokens

Python explorer showing tokens

Ozark shows tokens now!

fromscratchcode.com/ozark/

1 month ago 0 0 0 0

Visualizing lexer tokens today.

Found a bug that's existed for a couple years!

1 month ago 0 0 0 0
Python bytecode showing semicolon separators crossed with a single-line block.

Python bytecode showing semicolon separators crossed with a single-line block.

Also support this version now: semicolon separators cross with single-line blocks.

Can't say I've ever written code like this! But it works.

fromscratchcode.com/ozark/?code=...

2 months ago 0 0 0 0
Advertisement
Post image

PHEW. Things are good again.

2 months ago 0 0 1 0
Python bytecode compiler showing semicolon failure.

Python bytecode compiler showing semicolon failure.

EEK! Guess I don't support semicolons yet to separate statements.

2 months ago 0 0 1 0
Python bytecode without labels.

Python bytecode without labels.

Python bytecode with labels.

Python bytecode with labels.

After putting it off for weeks, I finally added assembler labels to Memphis bytecode.

Below is the before and after bytecode for this Python snippet.

s = 0
for i in [2,3,11]:
s = s + i

`JUMP -7` is now `JUMP -> L0`, and `FOR_ITER 6` becomes `FOR_ITER -> L1`. No more mental offset math!

2 months ago 0 0 0 0
Memphis REPL showing a NameError stack trace.

Memphis REPL showing a NameError stack trace.

Sometimes it feels like I'm not as far along as I thought.

#python #buildinpublic #memphis

3 months ago 7 0 1 0
Python REPL session showing object attribute access.

Python REPL session showing object attribute access.

Today I learned #Python attribute names have different rules in the syntax world `obj.attr` and the runtime world `getattr(obj, "attr")`.

One must be a valid identifier and the other can do whatever it wants!

3 months ago 1 0 0 0

lol. this was not correct.

Python doesn't allow relative imports using the "import ..." syntax!

The line

import a.b.c.d

would only write to "a" though, so that's something.

4 months ago 0 0 0 0
Preview
Write your first library Software mentorship for the quietly subversive.

This week I wrote about what you’ll learn by writing your first library.

fromscratchcode.com/blog/write-y...

4 months ago 3 0 0 0

I’m refactoring Memphis imports so I can add selective imports to the bytecode compiler.

Then I hit this gem:

import ...................a.b.c.d

#Python inserts exactly ONE symbol for this line.

Which one do you think it is?

4 months ago 1 0 0 1
Advertisement

Today I didn’t code much. Friday I FINALLY converted my Rust HTTP server (cairo!) to async.

4 months ago 2 0 0 0

nice lean approach!

4 months ago 0 0 0 0

nice job getting this out the door!

4 months ago 1 0 0 0

I'm hosting a small coding gathering tomorrow!

Since I'm not sharing the details about when or where, I expect to see none of you there.

In the biz, we call this wOrD oF mOuTh.

4 months ago 2 0 0 0

I wrote a bit on how I added socket support to Memphis. You can have a read here!

fromscratchcode.com/blog/memphis...

5 months ago 1 0 0 0