VegaDeftwing / OpGuidesHugoSrc

Repo for the development of OpGuides
Other
25 stars 15 forks source link

Custom Languages Part 1 #38

Closed jhwgh1968 closed 1 year ago

jhwgh1968 commented 1 year ago

This is a massive PR, I know. Hopefully it takes everything into account we discussed in other channels.

In brief, the flow is this:

  1. Start with easy to understand: a postfix calculator
  2. Realize it's sort of designed like a compiler if you squint
  3. Make it more formally like a compiler, splitting it into in phases to do the same trivial work
  4. Add a JIT library and explain its IR (current PR is up to here)
  5. Integrate that JIT library into the compiler we have
  6. Using the library, add features of a real language: variables, flow control, subroutines, etc
  7. Write a noteworthy program in the language, currently thinking AES encryption on a block of data
  8. Benchmark it compared to a pure Python version and be amazed
  9. Profit!

Suffice it to say, I chose this approach to embedding and formatting because otherwise I could not keep the Python reference blocks actually working together as I work on them. I'd be happy to take any organizational suggestions you have.

Also, there is one lazy ASCII art diagram in a text block. If you have a better approach for such "quick and dirty" diagrams, please let me know that too.

jhwgh1968 commented 1 year ago

I have figured out a way to integrate graphviz diagrams, but I've put it on a separate branch. I'll let you review this first.

VegaDeftwing commented 1 year ago

I'm currently focusing on finishing up the AI image generation blog post (Which I would greatly appreciate feedback on! - it's in the AIBlogPost branch) before I get to this, as that space is changing enough that what I have to say is time sensitive both for relevance and because the facts of the situation may change necessitating a re-write. I will probably get to this this weekend though.

VegaDeftwing commented 1 year ago

@jhwgh1968, I've made a few changes, almost all in presentation but some very minor to content. I was able to run the first python script fine, but don't have time to setup and run the others quite yet. So far, it's been a delight to read and I'm learning a lot. Thank you so much for all the hard work you're putting into this!!

jhwgh1968 commented 1 year ago

The diagram is certainly looking much better compared to my manual graphviz hack. I did see Mermaid, but Hugo versioning and package repos made it seem unsupported...

I'm glad you're learning and having fun! I also hope that my creating a Python module for my own testing is helpful for your testing as well. Making sure the code examples still work is really important as I continue forward.

jhwgh1968 commented 1 year ago

Hmm, I may have spoken too soon.

I intentionally did not set language=python on the blocks of included code because they broke. I thought your other changes had fixed that, but it seems not:

Screenshot_20221204_124231

VegaDeftwing commented 1 year ago

Hmm, I may have spoken too soon.

I intentionally did not set language=python on the blocks of included code because they broke. I thought your other changes had fixed that, but it seems not:

Screenshot_20221204_124231

Interesting. I have no issues at all,

image

Can you try updating your hugo install? Also, can you check on the actual, live website that the code blocks's numbers are aligned correctly for you, as it looks like your line numbers are broken locally as well, which is an issue I had a while back but have since resolved. You may also try clearing the browser cache entirely or at least ctrl+f5'ing the pages in development to see if that fixes it.

Edit: I just updated Hugo, so I'm on v107 now. I suspect you're still on a version prior to the one that made me fix the alignment of line numbers.

jhwgh1968 commented 1 year ago

Wow, the Hugo version in the system pkg manager is ancient. Using the 10-day-old 0.107 release does indeed fix it!

With that in place, it all looks good! Let me know if you have questions/clarifications.

VegaDeftwing commented 1 year ago

Do you want this to be merged now or for me to wait for Pt. 2?

I intend to get to testing all of the code very soon and will certainly do so before I click "Merge"

VegaDeftwing commented 1 year ago

Closes #33

jhwgh1968 commented 1 year ago

Do you want this to be merged now or for me to wait for Pt. 2?

I do indeed. Part 2 (and maybe 3) will be a while yet, and I broke it here because I thought it would be somewhat useful standing on its own.

I intend to get to testing all of the code very soon and will certainly do so before I click "Merge"

Please do, and let me know if you have any issues.

Closes # 33

At first I was about to ask, then I realized it was just the section headings, and this PR will indeed do that.

VegaDeftwing commented 1 year ago

This has been merged, but won't be live until the next time I publish changes to the site.