frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Irony and PathOS

https://github.com/jeffshrager/csminicourse/tree/main/from_code_to_machine
2•abrax3141•7mo ago

Comments

abrax3141•7mo ago
To "pre-teach" my son CS, I created a (highly) simplified code-to-bytecode-to-machine stack for a language called "irony", and (extremely simple) OS, called "pathos". (Hacker ethos: Hundreds of lines of code just to cache out a bad pun! :-)

The files "compiler.py" and "virtual_hardware.py" are the primary irony modules. Irony supports recursion, including mutual recursion, but nothing fancy. There's no lexer, so you need to put spaces between tokens. (Being a native Lisper, I hate lexers!)

compiler.py takes Irony source to byte code, and has a byte-code interpreter. virtual_hardware.py take the same byte code, but emulates actual hardware.

These are designed to go with an exercise where the student add FOR LOOP capability. Given the well-designed base, this is extremely simple, but requires understanding each step of the stack. ("compiler_for" and "virtual_hardware_for" are the solutions; The idea, of course, is not to give these to the student!)

(You'd think that it ought be the other way round: Start with for loops and then ask the student to add recursion, but it's much harder to add recursion than loops, so I put recursion into the base, and then ask the student to add for loops.)

The files "pathos.py" (which imports "irony.py") is a simple OS whose goal is to create, edit, compile, and run programs written in Irony. ("irony.py" is a combined version of compiler.py and virtual_hardware.py, but leaves out the byte code interpreter.) The "comp" and "exec" commands in pathos compile (to byte code) and then execute the reuslting byte code (basically assembly) on the emulated hardware. (See "pathos_demo.log".)

Everything here was written in about 5 total hours using a combination of chatbots. This wasn't as easy as I'd hoped. As many folks who use LLMs to assist in coding discover, they are bad at keeping track of even marginally complex or large projects, and don't deal well with conceptually twisty programming concepts. They were basically incapable of implementing recursion correctly, or generalizing to the desired level, and they kept losing their place in the series of steps. Eventually they would just seemingly lose track entirely and be unable to fix what turned out to be trivial errors, at which point I had to clear the decks entirely, reload the latest versions of the code base we were working on, and then re-explain the project and what to do next. In the end I had to give them nearly step-by-step guidance to get it right, and the way I wanted it to be, to be understandable and teachable. That said, to their credit, once I had the compiler and hardware emulator the understandable and teachable way I wanted it, I could feed those to the LLM and it was able to understand the code and make reasonable changes. For example, the entire FOR LOOP extension was done completely by Claude. I get that "pros" don't do it this way, but it's slightly fun trying to talk a chatbot into doing one's bidding, and being emacs-based, I don't have a magical code assistant built into my code editor. (I haven't even looked -- has someone already done that?)

Operating systems being conceptually simpler than programming languages, PATHOS was easier for the LLMs, and was almost entirely written by Claude, although based on several paragraph of detailed spec. And Claude was able to plug Irony into PATHOS (that is, create comp and exec commands) first try!

However, I then asked it to create a help command that simply listed all the other commands, which was nearly a trivial task, and it failed over and over, until I did one of those resets described above, and then it worked. (The attention model is just the wrong model of working and short term memory! Mark my words! [Yes, I do get my own meta-joke.])

I also asked the LLMs to make presentations. Those are here essentially "as is" and you'll see that although these are a reasonable start, they definitely aren't complete teaching materials.

jonjacky•7mo ago
"pathos" ...Hundreds of lines of code just to cache out a bad pun!

Clever name --- it's worth an upvote just for that!

Seriously, it's an interesting project and I appreciate the description of your experience with the chatbots.

Five disciplines discovered the same math independently – none of them knew

https://freethemath.org
1•energyscholar•46s ago•0 comments

We Scanned an AI Assistant for Security Issues: 12,465 Vulnerabilities

https://codeslick.dev/blog/openclaw-security-audit
1•vitorlourenco•1m ago•0 comments

Amazon no longer defend cloud customers against video patent infringement claims

https://ipfray.com/amazon-no-longer-defends-cloud-customers-against-video-patent-infringement-cla...
1•ffworld•2m ago•0 comments

Show HN: Medinilla – an OCPP compliant .NET back end (partially done)

https://github.com/eliodecolli/Medinilla
2•rhcm•5m ago•0 comments

How Does AI Distribute the Pie? Large Language Models and the Ultimatum Game

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6157066
1•dkga•5m ago•1 comments

Resistance Infrastructure

https://www.profgalloway.com/resistance-infrastructure/
2•samizdis•9m ago•0 comments

Fire-juggling unicyclist caught performing on crossing

https://news.sky.com/story/fire-juggling-unicyclist-caught-performing-on-crossing-13504459
1•austinallegro•10m ago•0 comments

Restoring a lost 1981 Unix roguelike (protoHack) and preserving Hack 1.0.3

https://github.com/Critlist/protoHack
2•Critlist•12m ago•0 comments

GPS and Time Dilation – Special and General Relativity

https://philosophersview.com/gps-and-time-dilation/
1•mistyvales•15m ago•0 comments

Show HN: Witnessd – Prove human authorship via hardware-bound jitter seals

https://github.com/writerslogic/witnessd
1•davidcondrey•15m ago•1 comments

Show HN: I built a clawdbot that texts like your crush

https://14.israelfirew.co
2•IsruAlpha•17m ago•2 comments

Scientists reverse Alzheimer's in mice and restore memory (2025)

https://www.sciencedaily.com/releases/2025/12/251224032354.htm
1•walterbell•20m ago•0 comments

Compiling Prolog to Forth [pdf]

https://vfxforth.com/flag/jfar/vol4/no4/article4.pdf
1•todsacerdoti•21m ago•0 comments

Show HN: Cymatica – an experimental, meditative audiovisual app

https://apps.apple.com/us/app/cymatica-sounds-visualizer/id6748863721
1•_august•23m ago•0 comments

GitBlack: Tracing America's Foundation

https://gitblack.vercel.app/
2•martialg•23m ago•0 comments

Horizon-LM: A RAM-Centric Architecture for LLM Training

https://arxiv.org/abs/2602.04816
1•chrsw•23m ago•0 comments

We just ordered shawarma and fries from Cursor [video]

https://www.youtube.com/shorts/WALQOiugbWc
1•jeffreyjin•24m ago•1 comments

Correctio

https://rhetoric.byu.edu/Figures/C/correctio.htm
1•grantpitt•24m ago•0 comments

Trying to make an Automated Ecologist: A first pass through the Biotime dataset

https://chillphysicsenjoyer.substack.com/p/trying-to-make-an-automated-ecologist
1•crescit_eundo•28m ago•0 comments

Watch Ukraine's Minigun-Firing, Drone-Hunting Turboprop in Action

https://www.twz.com/air/watch-ukraines-minigun-firing-drone-hunting-turboprop-in-action
1•breve•29m ago•0 comments

Free Trial: AI Interviewer

https://ai-interviewer.nuvoice.ai/
1•sijain2•29m ago•0 comments

FDA intends to take action against non-FDA-approved GLP-1 drugs

https://www.fda.gov/news-events/press-announcements/fda-intends-take-action-against-non-fda-appro...
21•randycupertino•31m ago•12 comments

Supernote e-ink devices for writing like paper

https://supernote.eu/choose-your-product/
3•janandonly•33m ago•0 comments

We are QA Engineers now

https://serce.me/posts/2026-02-05-we-are-qa-engineers-now
1•SerCe•33m ago•0 comments

Show HN: Measuring how AI agent teams improve issue resolution on SWE-Verified

https://arxiv.org/abs/2602.01465
2•NBenkovich•33m ago•0 comments

Adversarial Reasoning: Multiagent World Models for Closing the Simulation Gap

https://www.latent.space/p/adversarial-reasoning
1•swyx•34m ago•0 comments

Show HN: Poddley.com – Follow people, not podcasts

https://poddley.com/guests/ana-kasparian/episodes
1•onesandofgrain•42m ago•0 comments

Layoffs Surge 118% in January – The Highest Since 2009

https://www.cnbc.com/2026/02/05/layoff-and-hiring-announcements-hit-their-worst-january-levels-si...
13•karakoram•42m ago•0 comments

Papyrus 114: Homer's Iliad

https://p114.homemade.systems/
1•mwenge•42m ago•1 comments

DicePit – Real-time multiplayer Knucklebones in the browser

https://dicepit.pages.dev/
1•r1z4•42m ago•1 comments