Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
384a9a7
Initial start on AP transpiler
IQubic Apr 16, 2026
c935b9d
Update ap namespace to soh_ap
mattman107 May 5, 2026
1f635fc
Fix region lambdas
mattman107 May 5, 2026
990409a
Add missing space and comment out code that was ued in the developmen…
mattman107 May 5, 2026
2b8da28
Fix not case
mattman107 May 6, 2026
51a935a
Update other transpiler name locations I missed
mattman107 May 10, 2026
07e4178
Merge branch 'main' of https://github.com/xxAtrain223/RandoLogicScrip…
mattman107 May 10, 2026
92c859f
Implement active in rls_match correctly
mattman107 May 11, 2026
988365c
Add bundle and update to the new vector
mattman107 May 11, 2026
e836a73
Add import
mattman107 May 11, 2026
b712b43
Merge branch 'main' of https://github.com/xxAtrain223/RandoLogicScrip…
mattman107 May 14, 2026
d9e6140
Auto generate some enums
mattman107 May 15, 2026
9d69a83
Make enum creation better
mattman107 May 15, 2026
043ac39
Filter out unnecessary add_event, add_locations, and connect_region c…
mattman107 May 16, 2026
a421810
Update to RuleBuilder rules
mattman107 Jun 14, 2026
073b792
Add handling for can_afford_slot location
mattman107 Jun 14, 2026
c8eed07
Overhaul OptionFilter creation
mattman107 Jun 18, 2026
f10b0f9
Merge branch 'main' of https://github.com/xxAtrain223/RandoLogicScrip…
mattman107 Jun 21, 2026
86cb4ad
Split SoH transpiler into generic ap base + derived SohAp
mattman107 Jun 21, 2026
2a1b461
Fix conflicts after upstream changes. Updated to use new callables
mattman107 Jun 21, 2026
db03848
Add AP function generation (functions.gen.py) to soh_ap transpiler.
mattman107 Jun 27, 2026
8e79d49
Merge branch 'main' of https://github.com/xxAtrain223/RandoLogicScrip…
mattman107 Jun 27, 2026
2e4bfd6
Fix AP Transpilers to remove shared block and add HereRef.
mattman107 Jun 27, 2026
66c70c7
Lower rule-conditioned value-branch ternary call args to rls_conditio…
mattman107 Jul 12, 2026
54365cd
Merge branch 'main' of https://github.com/xxAtrain223/RandoLogicScrip…
mattman107 Aug 15, 2026
043c45d
Update AP transpilers to use the First Class enum support.
mattman107 Aug 15, 2026
5a49075
Add enum support to the AP transpilers
mattman107 Aug 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RandoLogicScript -t soh -o out/soh/ src/
Multiple transpilers can be specified, each with their own output directory:

```
RandoLogicScript -t soh -o out/soh/ -t ap -o out/ap/ src/ extra.rls
RandoLogicScript -t soh -o out/soh/ -t soh_ap -o out/ap/ src/ extra.rls
```

Input paths can be individual `.rls` files or directories (which are recursively scanned for `.rls` files).
Expand All @@ -35,7 +35,7 @@ Input paths can be individual `.rls` files or directories (which are recursively
| Name | Target |
| ------------ | ---------------------- |
| `soh` | C++ for Shipwright |
| `ap` | Python for Archipelago |
| `soh_ap` | Python for Archipelago |

## Docs

Expand Down
4 changes: 2 additions & 2 deletions console/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ add_executable(RandoLogicScript
main.cpp
)

target_link_libraries(RandoLogicScript PRIVATE ast parser sema soh ap)
target_link_libraries(RandoLogicScript PRIVATE ast parser sema soh soh_ap)

if(BUILD_TESTING)
rls_add_gtest(console_acceptance_tests
tests/acceptance_soh_tests.cpp
tests/acceptance_ap_tests.cpp
)
target_link_libraries(console_acceptance_tests PRIVATE ast parser sema soh ap)
target_link_libraries(console_acceptance_tests PRIVATE ast parser sema soh soh_ap)
target_compile_definitions(console_acceptance_tests PRIVATE
RLS_REPO_ROOT="${CMAKE_SOURCE_DIR}"
)
Expand Down
26 changes: 22 additions & 4 deletions console/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "output.h"
#include "parser.h"
#include "sema.h"
#include "ap.h"
#include "soh_ap.h"
#include "soh.h"

namespace fs = std::filesystem;
Expand All @@ -24,7 +24,7 @@ static void printUsage(const char* program) {
<< "Options:\n"
<< " -t, --transpiler <name> -o, --output <dir>\n"
<< " Transpiler and output directory pair (may be repeated).\n"
<< " Available transpilers: soh, ap\n"
<< " Available transpilers: soh, soh_ap\n"
<< " -h, --help Show this help message.\n";
}

Expand Down Expand Up @@ -74,7 +74,7 @@ struct TranspilerConfig {
};

static bool runTranspiler(const TranspilerConfig& config, const rls::ast::Project& project) {
if (config.name != "soh" && config.name != "ap") {
if (config.name != "soh" && config.name != "soh_ap") {
std::cerr << "error: unknown transpiler '" << config.name << "'\n";
return false;
}
Expand All @@ -93,8 +93,26 @@ static bool runTranspiler(const TranspilerConfig& config, const rls::ast::Projec
std::cerr << "aborting due to SoH transpiler errors\n";
return false;
}
} else if (config.name == "soh_ap") {
rls::transpilers::soh_ap::SohApTranspiler transpiler(project);
transpiler.Transpile(writer);

// Surface constructs the RuleBuilder target cannot represent (negating a rule,
// a rule-conditioned ternary with no known complement, a runtime value combined
// with a rule). Abort rather than ship Python that raises at world-load.
bool hasErrors = false;
for (const auto& d : transpiler.Diagnostics()) {
printDiagnostic(d);
if (d.level == rls::ast::DiagnosticLevel::Error)
hasErrors = true;
}
if (hasErrors) {
std::cerr << "aborting: '" << config.name << "' could not represent some rules\n";
return false;
}
} else {
rls::transpilers::ap::Transpile(project, writer);
std::cerr << "error: unknown transpiler '" << config.name << "'\n";
return false;
}

return true;
Expand Down
8 changes: 4 additions & 4 deletions console/tests/acceptance_ap_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ TEST(AcceptanceAp, ExamplesRlsMatchesGolden) {
const auto project = parseAndAnalyzeProject(repoPath("examples/rls"), errors);
ASSERT_TRUE(errors.empty()) << joinLines(errors);

TempDirectory outputDir("ap");
TempDirectory outputDir("soh_ap");
{
DirectoryWriter writer(outputDir.path());
rls::transpilers::ap::Transpile(project, writer);
rls::transpilers::soh_ap::SohApTranspiler(project).Transpile(writer);
}

expectDirectoryMatchesGolden(
outputDir.path(),
repoPath("examples/ap"),
R"(.\build\console\RandoLogicScript.exe -t ap -o .\examples\ap .\examples\rls)");
repoPath("examples/soh_ap"),
R"(.\build\console\RandoLogicScript.exe -t soh_ap -o .\examples\soh_ap .\examples\rls)");
}
2 changes: 1 addition & 1 deletion console/tests/acceptance_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <system_error>
#include <vector>

#include "ap.h"
#include "soh_ap.h"
#include "ast.h"
#include "output.h"
#include "parser.h"
Expand Down
Loading