{"id":20210948,"url":"https://github.com/brahle/paradox","last_synced_at":"2025-07-27T00:36:08.693Z","repository":{"id":139071695,"uuid":"299148844","full_name":"brahle/paradox","owner":"brahle","description":"ANTLR parser definitions for Paradox games like Hearts of Iron 4, Crusader Kings 3, and Stellaris.","archived":false,"fork":false,"pushed_at":"2020-10-03T23:04:09.000Z","size":96,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T13:43:20.740Z","etag":null,"topics":["antlr","antlr4","crusader-kings-3","crusader-kings-iii","hearts-of-iron-4","hearts-of-iron-iv","parser","stellaris"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brahle.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-28T00:52:05.000Z","updated_at":"2024-06-01T23:48:14.000Z","dependencies_parsed_at":"2024-03-30T23:15:41.809Z","dependency_job_id":null,"html_url":"https://github.com/brahle/paradox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/brahle/paradox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brahle%2Fparadox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brahle%2Fparadox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brahle%2Fparadox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brahle%2Fparadox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brahle","download_url":"https://codeload.github.com/brahle/paradox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brahle%2Fparadox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267276997,"owners_count":24063221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antlr","antlr4","crusader-kings-3","crusader-kings-iii","hearts-of-iron-4","hearts-of-iron-iv","parser","stellaris"],"created_at":"2024-11-14T05:50:17.257Z","updated_at":"2025-07-27T00:36:08.671Z","avatar_url":"https://github.com/brahle.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paradox ANTLR File Parser\n\nThis project that contains the [ANTLR](https://www.antlr.org/) definitions for a Paradox file parser. It should work with Paradox games like Hearts of Iron IV, Stellaris and Crusader Kings 3, and should allow you to make your own parser in any of the languages that ANTLR supports, like Java, C#, Python 2, Python 3, JavaScript, Go, C++, Swift, PHP and Dart.\n\nThere are two versions of the parser:\n\n1. [PardoxFile.g4](src/antlr/ParadoxFile.g4) - this parser should work for most Paradox files.\n2. [PardoxFast.g4](src/antlr/ParadoxFast.g4) - this parser assumes that the Paradox file is \"nicely\" formatted - e.g. arrays can't have assignments inside, there are no special declarations of lists, and there are no expressions using variables. This allows this parser to be about 6x faster than the other one.\n\n# Usage instructions\n\nYou should use the antlr definition files from above to generate bindings for your favourite language and use it to implement something actually useful.\n\n## Build instructions\n\nThis repository only includes a trivial parser implementation - [main.cpp](src/main.cpp) and [main-fast.cpp](src/main-fast.cpp). If you desperately want to build this project, you can use the [Makefile](Makefile). You may need to fix the paths to the antlr jar in the Makefile first, though.\n\nRequirements:\n- Ubuntu for Windows Subsystem For Linux (WSL) running on Windows 10.\n- g++ 5.4.0\n- antlr 4.8\n\nTo build:\n\n```bash\n$ make -j 6 antlr.ParadoxFile.o main\n```\n\nor\n\n```bash\n$ make -j 6 antlr.ParadoxFast.o main-fast\n```\n\nThis creates the `bin/main(-fast)` executable. To run the parser on `.txt` files in a hierarchy (e.g. from the [tests](tests) folder), you can do something like this:\n\n```bash\n$ find  tests/ -type f | grep txt | xargs -n 1 -I {} bin/main \"{}\"\n```\n\nIf you want to test it on a larger number of files (e.g. everything within the game folder), you can use the `xargs` parallelism switch (`-P n`, where `n` is the number of parallel processes).\n\n# Tests\n\nBesides the contents [tests](tests) folder, this has been tested by running the parser against:\n\n- Stellaris save game\n- All .txt files from the `%steamapps%\\common\\Stellaris\\common` directory (version 2.7.2)\n- All .txt files from the `%steamapps%\\common\\Crusader Kings III\\game\\common` directory (version 1.1.2).\n- All .txt files from the `%steamapps%\\common\\Hearts of Iron IV\\common` directory (version 1.9.3).\n  - Note: The parser fails to parse the following files:\n    - `on_actions/04_mtg_on_actions.txt` - file is not using the UTF-8 encoding, but Windows-1252. It should work fine if the encoding is fixed.\n    - `on_actions/05_lar_on_actions.txt` - file is not using the UTF-8 encoding, but Windows-1252. It should work fine if the encoding is fixed.\n    - `units/names_divisions/BRA_names_divisions.txt` - file is missing a closing `}` at the end.\n\n# Special thanks\n\nInitial implementation taken from https://github.com/rikbrown/klausewitz-parser\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrahle%2Fparadox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrahle%2Fparadox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrahle%2Fparadox/lists"}