Skip to content

Logic DSL#5682

Draft
serprex wants to merge 20 commits intoHarbourMasters:developfrom
serprex:logic-tracker
Draft

Logic DSL#5682
serprex wants to merge 20 commits intoHarbourMasters:developfrom
serprex:logic-tracker

Conversation

@serprex
Copy link
Member

@serprex serprex commented Jul 19, 2025

used #5674 to export logic to s-expressions & generate cpp file instead

This opens up various future improvements:

  • output Python code for Archipelago
  • output AST structure so Logic Tracker/Viewer #5674 doesn't have to parse it
  • output logic to C to improve compile time
  • output code in a way where logic tracks dependencies so when event/progression happens don't need to reevaluate everything
  • generate randomizer types
  • generate entrance rando tables (& also handle multiple paths to a shuffled entrance by automating creating pseudo entrance?)

Build Artifacts

@Pepe20129
Copy link
Contributor

Will this require logic be written in this new format or will logic.s be generated from the current C++ logic?

@serprex
Copy link
Member Author

serprex commented Jul 19, 2025

Will this require logic be written in this new format or will logic.s be generated from the current C++ logic?

Yes, logic will be written in new format. Going to split up logic.s soon, but this become the new source, cpp is just generated (& switching output to C is high on my followups)

@Pepe20129
Copy link
Contributor

I really don't like the new format, imo it makes logic harder to read & write.
Specially the prefix notation instead of infix notation but also some other minor things like using or instead of ||, using and instead of &&, the lack of parenthesis for function calls, the fact that there's no indentation whatsoever making it harder to know which checks are from which regions at a glance, etc

@serprex
Copy link
Member Author

serprex commented Jul 20, 2025

Prefix notation is in the air, s-expressions have the benefit of being the absence of syntax. Syntax is minor, discussion seemed to get overly hung up on it. So wanted to get something out that can discuss other aspects, & then transform can apply syntax afterwards. I would suggest that you try & view this without a C perspective. Really I'd prefer if this had syntax more like Haskell

There's not much indentation in the existing logic files, but have already received feedback about keeping //Events //Locations //Exits comments to section things

So I'm trying to address most of what you're pointing out, but on function calls this is actually pretty important for them to look the same as logical flags. There's designs to make logic code reactive, like S.js. They're stuck with JS so every getter has to be explicitly called, whereas we have the benefit of having this layer to skip that

Whether something is a function call without arguments or a field is irrelevant to logic. It's an implementation detail, & in fact the point is that we should be able to change the implementation underneath (or have generators with different implementation) without having to rewrite logic. These are all potentially reactive values

@serprex serprex changed the title WIP: logic DSL Logic DSL Jul 20, 2025
@serprex serprex marked this pull request as ready for review July 20, 2025 16:11
@serprex
Copy link
Member Author

serprex commented Jul 21, 2025

Archipelago output would want to look like aMannus/Archipelago#6

@serprex serprex marked this pull request as draft December 15, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants