Making Programming Language in Python -- Porth Ep.01

preview_player
Показать описание
References:
Рекомендации по теме
Комментарии
Автор

Watching you work makes me realize how good it is to learn all the various hotkeys of an editor

dimi
Автор

These two concepts have never been uttered in the same sentence before...until now: "To make it easier for myself" .... "Assembly"

jaya
Автор

Waw man this video. Demystified a lot of concepts with how compilers and programming languages r constructed. The way how u talk through the process is extremely enlightening. Treasure chest.

bigmistqke
Автор

Instead of "assert False" and giving a "non-implemented" message, you could just do "raise

ElGnomistico
Автор

Not that far in, but with Go, you don't have to specify iota on the next lines.

const (
A = iota
B
C
)

You can also do types

type ID int

const (
A ID = iota
B
C
)

C will be type of ID.

apollowellstein
Автор

I love how you're making complex stuff accessible.

TB-tvzf
Автор

I really respect your work, normally I dislike using python for anything beyond simple scripts but I can get behind the idea of using it to quickly bootstrap your language haha. And you obviously know your stuff. Great work!

treymk
Автор

this language encapsulates the magic of doing programming, is simple, is just like a joke but is funny in a working way, is like the dreams programming everybody haved to have learned, this is awesome and i apreciate your work Rexim, thankyouu so mutch for Streamming.

eliseulucenabarros
Автор

It's fun to look back at this now. You've come so far. I totally forgot about simulation mode.

TheOisannNetwork
Автор

If you're on a recent version of Python 3, you should be able to do "program, *argv = argv" instead of using uncons.

pigworts
Автор

I think I'm gonna learn linux and start advanced programming by simply watching your videos and every 3 seconds when I don't know what something means look it up.

astrahcat
Автор

I don't know if it's any relevant now, but list are always pass by reference. The unexpected behavior here caused by just rebinding xs variable. But a xs.pop(0) will do exactly what you want. So essentially it's more like c pointer, not reference.

barterjke
Автор

That's the first couple of bugs that compensate each other I've seen and it's so funny.
So, in the beginning, when you've been making the simulation mode, you've put assertion to check if the number of operations is equal to 4, while you only had 3: PUSH, PLUS and DUMP. And you didn't notice it. I thought you would run into an error, but then you added an extra DUMP operation into your enum and forgot to remove it, which offsets it by one, and your code works just fine, you get the result of the addition correctly. Not two bugs. One feature.

ZERRR
Автор

The transformer model used for codex requires a ton of data to train. The idea of training it on just your code could be challenging!

visintel
Автор

Have you considered compiling it to LLVM Intermediate Representation rather than x86_64 assembly? That way you can plug in LLVM as the backend and get compilation for a bunch of platforms "for free" (or at least for very cheap, versus just using x86_64). From my brief stint with LLVM IR, it is slightly similar to x86 assembly.

markozagar
Автор

Loved seeing that you have aoc20xx folders too. Thanks.

pamdemonia
Автор

To be completely honest, the way you did the "iota" is seemingly pretty close to what the "auto()" function of the Enum class already does.

EDIT: Watching your later videos, it seems you realised this, and made that change :)

TheArrowedKnee
Автор

A little late, but Python Lists have .pop(0), so you could use that instead of _, argv = argv

kazaniavali
Автор

honestly as someone who only kinda knows c#, this was really interesting and well explained, i understood almost all of your thought process and code. this was dope.

also noob question - are you using vim as your code editor or is it something simmilar?

fkeyzuwu
Автор

The main difference between Porth and Forth is that Porth is a compiled languge, and Forth is an interpreted language (like Python). Forth has special words to switch between interpretation and compilation mode (words like '[' and ']' and '[COMPILE]'). Each Forth word has a Flag, indicating in the word is an IMMEDIATE word or not - immediate words are executed in compilation mode. Such words can be used to create other defining words. The word POSTPONE can be used to override the immediate flag of the word that follows. etc.
Further, Forth allows multiple vocabularies.

robheusd