Advertisement · 728 × 90

Posts by Tyler (Jones Beach)

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.

3 days 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.

3 days 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`.

3 days ago 0 0 1 0

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!

1 week 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.

1 week 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`.

1 week 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__.

1 week 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!

1 week ago 0 1 0 0

Yikes!

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

2 weeks ago 0 0 0 1
Advertisement

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=...

1 month ago 0 0 0 0
Post image

PHEW. Things are good again.

1 month 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.

1 month 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!

1 month 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
Advertisement
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.

3 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

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...

4 months ago 1 0 0 0
Advertisement
Video

Memphis now has a stdlib for handling network requests.

Here's a short demo!

5 months ago 2 0 0 1

A) github.com/JonesBeach/e...
B) github.com/JonesBeach/c...
C) github.com/JonesBeach/m...

Thanks for taking a look!

5 months ago 1 0 0 0

A) Building an HTTP server in Python
B) Building an HTTP server in Rust
C) Building a language runtime in Rust...which can run the Python HTTP server

I didn’t plan to build all three, but here we are. Now how to make this a resource.

What would you want to learn from it?

#python #rustlang

5 months ago 5 0 1 0
Preview
One year of From Scratch Notes from rebuilding on my own terms.

Sharing a few notes about one year of building From Scratch!

#substack #buildinpublic

5 months ago 3 1 0 0