├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ └── main.yml ├── .gitignore ├── .vscode ├── extensions.json └── settings.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── bolt ├── __init__.py ├── ast.py ├── codegen.py ├── commands.py ├── contrib │ ├── __init__.py │ ├── debug_codegen.py │ ├── defer.py │ └── sandbox.py ├── emit.py ├── helpers.py ├── loop_info.py ├── memo.py ├── module.py ├── parse.py ├── pattern.py ├── plugin.py ├── py.typed ├── resources │ ├── __init__.py │ └── commands.json ├── runtime.py ├── semantics.py └── utils.py ├── examples ├── bolt_1_20 │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_assets │ ├── beet.yml │ └── src │ │ └── assets │ │ └── demo │ │ └── modules │ │ └── foo.bolt ├── bolt_basic │ ├── beet.yml │ ├── random_data.json │ └── src │ │ └── data │ │ └── demo │ │ ├── functions │ │ ├── attribute_rebind.mcfunction │ │ ├── foo.mcfunction │ │ ├── import_a.mcfunction │ │ ├── import_b.mcfunction │ │ ├── thing.mcfunction │ │ └── utils.mcfunction │ │ └── modules │ │ └── utils.bolt ├── bolt_chained_comp │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_chicken │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ ├── functions │ │ └── chicken.mcfunction │ │ └── modules │ │ └── utils.bolt ├── bolt_circular │ ├── beet.yml │ └── src │ │ ├── bar.bolt │ │ ├── foo.bolt │ │ └── main.bolt ├── bolt_class │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── foo.mcfunction │ │ └── pydantic.mcfunction ├── bolt_compile_cached │ ├── beet.yml │ ├── cached │ │ └── slow.mcfunction │ ├── compile_cached.py │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_custom_provider │ ├── beet.yml │ ├── custom_provider.py │ └── src │ │ └── data │ │ └── demo │ │ ├── custom │ │ └── stuff.bolt │ │ └── functions │ │ └── foo.mcfunction ├── bolt_debug │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── bar.mcfunction │ │ └── foo.mcfunction ├── bolt_defer │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_docstring │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_flat │ ├── beet.yml │ └── demo │ │ ├── __init__.py │ │ ├── main.bolt │ │ └── math.py ├── bolt_function_signature │ ├── beet.yml │ └── foo.mcfunction ├── bolt_generated │ ├── beet.yml │ ├── demo.py │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_json │ ├── beet.yml │ └── src │ │ └── data │ │ └── minecraft │ │ └── tags │ │ └── functions │ │ └── load.json ├── bolt_lazy │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── modules │ │ ├── foo.bolt │ │ ├── hello1.lazy.bolt │ │ └── hello2.lazy.bolt ├── bolt_lectern_prelude │ ├── beet.yml │ └── source.txt ├── bolt_loop │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── foo.mcfunction │ │ └── init.mcfunction ├── bolt_macro │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── bar.mcfunction │ │ ├── foo.mcfunction │ │ └── redirect.mcfunction ├── bolt_macro_perf │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── export.mcfunction │ │ ├── func1.mcfunction │ │ ├── func2.mcfunction │ │ └── lib.mcfunction ├── bolt_memo │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── bar.mcfunction │ │ ├── foo.mcfunction │ │ └── vars.mcfunction ├── bolt_memo2 │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_memo3 │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_memo4 │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_merge │ ├── beet.yml │ ├── pack_1 │ │ └── data │ │ │ └── pack_1 │ │ │ └── functions │ │ │ ├── bob.mcfunction │ │ │ └── utils.mcfunction │ └── pack_2 │ │ └── data │ │ └── pack_2 │ │ └── functions │ │ └── carol.mcfunction ├── bolt_nested_location │ ├── beet.yml │ └── src │ │ └── data │ │ ├── demo │ │ └── functions │ │ │ └── foo.mcfunction │ │ └── ref │ │ └── functions │ │ └── foo.mcfunction ├── bolt_nesting │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_order │ ├── beet.yml │ └── src │ │ └── data │ │ └── hello │ │ └── modules │ │ ├── entry_point.bolt │ │ └── main.bolt ├── bolt_overgen │ ├── beet.yml │ ├── overgen.py │ └── src │ │ └── data │ │ └── demo │ │ ├── functions │ │ └── foo.mcfunction │ │ └── overgen │ │ └── stuff.bolt ├── bolt_overlay │ ├── beet.yml │ └── src │ │ ├── data │ │ └── demo │ │ │ ├── functions │ │ │ └── foo.mcfunction │ │ │ └── modules │ │ │ └── vars.bolt │ │ └── dummy_overlay │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_patchers │ ├── beet.yml │ ├── patchers.py │ └── src │ │ └── data │ │ ├── demo │ │ ├── functions │ │ │ └── foo.mcfunction │ │ └── patchers │ │ │ └── arrow_recipes.bolt │ │ └── minecraft │ │ └── recipes │ │ ├── arrow.json │ │ ├── spectral_arrow.json │ │ └── tipped_arrow.json ├── bolt_prelude │ ├── beet.yml │ └── src │ │ └── data │ │ ├── demo │ │ ├── functions │ │ │ ├── bar.mcfunction │ │ │ └── foo.mcfunction │ │ └── modules │ │ │ ├── macros.bolt │ │ │ ├── other.bolt │ │ │ └── prelude.bolt │ │ └── no_idea │ │ └── modules │ │ ├── aaa.bolt │ │ ├── bbb.bolt │ │ └── prelude.bolt ├── bolt_proc_macro │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ ├── foo.mcfunction │ │ └── util.mcfunction ├── bolt_sample_ui │ ├── beet.yml │ ├── sample_ui │ │ ├── __init__.py │ │ ├── generate.py │ │ ├── modules │ │ │ └── main.bolt │ │ └── resources.py │ └── src │ │ └── data │ │ └── demo │ │ └── ui_screens │ │ └── foo.xml ├── bolt_shadow_global │ ├── beet.yml │ ├── demo.py │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_strip_final_newline │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_summon │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction ├── bolt_too_many_statically_nested_blocks │ ├── beet.yml │ └── src │ │ └── data │ │ └── demo │ │ └── functions │ │ └── foo.mcfunction └── bolt_type_annotations │ ├── beet.yml │ └── src │ └── data │ └── demo │ └── functions │ └── foo.mcfunction ├── package-lock.json ├── package.json ├── poetry.lock ├── pyproject.toml ├── setup.py ├── tests ├── __init__.py ├── conftest.py ├── resources │ ├── bolt_examples.mcfunction │ └── sandbox_examples.mcfunction ├── snapshots │ ├── bolt__parse_0__0.txt │ ├── bolt__parse_0__1.txt │ ├── bolt__parse_100__0.txt │ ├── bolt__parse_100__1.txt │ ├── bolt__parse_101__0.txt │ ├── bolt__parse_101__1.txt │ ├── bolt__parse_102__0.txt │ ├── bolt__parse_102__1.txt │ ├── bolt__parse_103__0.txt │ ├── bolt__parse_103__1.txt │ ├── bolt__parse_104__0.txt │ ├── bolt__parse_104__1.txt │ ├── bolt__parse_105__0.txt │ ├── bolt__parse_105__1.txt │ ├── bolt__parse_106__0.txt │ ├── bolt__parse_106__1.txt │ ├── bolt__parse_107__0.txt │ ├── bolt__parse_107__1.txt │ ├── bolt__parse_108__0.txt │ ├── bolt__parse_108__1.txt │ ├── bolt__parse_109__0.txt │ ├── bolt__parse_109__1.txt │ ├── bolt__parse_10__0.txt │ ├── bolt__parse_10__1.txt │ ├── bolt__parse_110__0.txt │ ├── bolt__parse_110__1.txt │ ├── bolt__parse_111__0.txt │ ├── bolt__parse_111__1.txt │ ├── bolt__parse_112__0.txt │ ├── bolt__parse_112__1.txt │ ├── bolt__parse_113__0.txt │ ├── bolt__parse_113__1.txt │ ├── bolt__parse_114__0.txt │ ├── bolt__parse_114__1.txt │ ├── bolt__parse_115__0.txt │ ├── bolt__parse_116__0.txt │ ├── bolt__parse_117__0.txt │ ├── bolt__parse_117__1.txt │ ├── bolt__parse_118__0.txt │ ├── bolt__parse_118__1.txt │ ├── bolt__parse_119__0.txt │ ├── bolt__parse_11__0.txt │ ├── bolt__parse_11__1.txt │ ├── bolt__parse_120__0.txt │ ├── bolt__parse_120__1.txt │ ├── bolt__parse_121__0.txt │ ├── bolt__parse_122__0.txt │ ├── bolt__parse_123__0.txt │ ├── bolt__parse_124__0.txt │ ├── bolt__parse_125__0.txt │ ├── bolt__parse_126__0.txt │ ├── bolt__parse_126__1.txt │ ├── bolt__parse_127__0.txt │ ├── bolt__parse_127__1.txt │ ├── bolt__parse_128__0.txt │ ├── bolt__parse_128__1.txt │ ├── bolt__parse_129__0.txt │ ├── bolt__parse_129__1.txt │ ├── bolt__parse_12__0.txt │ ├── bolt__parse_12__1.txt │ ├── bolt__parse_130__0.txt │ ├── bolt__parse_130__1.txt │ ├── bolt__parse_131__0.txt │ ├── bolt__parse_131__1.txt │ ├── bolt__parse_132__0.txt │ ├── bolt__parse_132__1.txt │ ├── bolt__parse_133__0.txt │ ├── bolt__parse_133__1.txt │ ├── bolt__parse_134__0.txt │ ├── bolt__parse_134__1.txt │ ├── bolt__parse_135__0.txt │ ├── bolt__parse_135__1.txt │ ├── bolt__parse_136__0.txt │ ├── bolt__parse_136__1.txt │ ├── bolt__parse_137__0.txt │ ├── bolt__parse_137__1.txt │ ├── bolt__parse_138__0.txt │ ├── bolt__parse_138__1.txt │ ├── bolt__parse_139__0.txt │ ├── bolt__parse_139__1.txt │ ├── bolt__parse_13__0.txt │ ├── bolt__parse_13__1.txt │ ├── bolt__parse_140__0.txt │ ├── bolt__parse_140__1.txt │ ├── bolt__parse_141__0.txt │ ├── bolt__parse_141__1.txt │ ├── bolt__parse_142__0.txt │ ├── bolt__parse_142__1.txt │ ├── bolt__parse_143__0.txt │ ├── bolt__parse_143__1.txt │ ├── bolt__parse_144__0.txt │ ├── bolt__parse_144__1.txt │ ├── bolt__parse_145__0.txt │ ├── bolt__parse_145__1.txt │ ├── bolt__parse_146__0.txt │ ├── bolt__parse_147__0.txt │ ├── bolt__parse_148__0.txt │ ├── bolt__parse_149__0.txt │ ├── bolt__parse_14__0.txt │ ├── bolt__parse_14__1.txt │ ├── bolt__parse_150__0.txt │ ├── bolt__parse_150__1.txt │ ├── bolt__parse_151__0.txt │ ├── bolt__parse_151__1.txt │ ├── bolt__parse_152__0.txt │ ├── bolt__parse_152__1.txt │ ├── bolt__parse_153__0.txt │ ├── bolt__parse_153__1.txt │ ├── bolt__parse_154__0.txt │ ├── bolt__parse_154__1.txt │ ├── bolt__parse_155__0.txt │ ├── bolt__parse_156__0.txt │ ├── bolt__parse_156__1.txt │ ├── bolt__parse_157__0.txt │ ├── bolt__parse_158__0.txt │ ├── bolt__parse_159__0.txt │ ├── bolt__parse_15__0.txt │ ├── bolt__parse_15__1.txt │ ├── bolt__parse_160__0.txt │ ├── bolt__parse_160__1.txt │ ├── bolt__parse_161__0.txt │ ├── bolt__parse_161__1.txt │ ├── bolt__parse_162__0.txt │ ├── bolt__parse_162__1.txt │ ├── bolt__parse_163__0.txt │ ├── bolt__parse_163__1.txt │ ├── bolt__parse_164__0.txt │ ├── bolt__parse_164__1.txt │ ├── bolt__parse_165__0.txt │ ├── bolt__parse_165__1.txt │ ├── bolt__parse_166__0.txt │ ├── bolt__parse_166__1.txt │ ├── bolt__parse_167__0.txt │ ├── bolt__parse_167__1.txt │ ├── bolt__parse_168__0.txt │ ├── bolt__parse_168__1.txt │ ├── bolt__parse_169__0.txt │ ├── bolt__parse_169__1.txt │ ├── bolt__parse_16__0.txt │ ├── bolt__parse_16__1.txt │ ├── bolt__parse_170__0.txt │ ├── bolt__parse_170__1.txt │ ├── bolt__parse_171__0.txt │ ├── bolt__parse_171__1.txt │ ├── bolt__parse_172__0.txt │ ├── bolt__parse_173__0.txt │ ├── bolt__parse_174__0.txt │ ├── bolt__parse_174__1.txt │ ├── bolt__parse_175__0.txt │ ├── bolt__parse_175__1.txt │ ├── bolt__parse_176__0.txt │ ├── bolt__parse_176__1.txt │ ├── bolt__parse_177__0.txt │ ├── bolt__parse_178__0.txt │ ├── bolt__parse_179__0.txt │ ├── bolt__parse_17__0.txt │ ├── bolt__parse_17__1.txt │ ├── bolt__parse_180__0.txt │ ├── bolt__parse_181__0.txt │ ├── bolt__parse_181__1.txt │ ├── bolt__parse_182__0.txt │ ├── bolt__parse_182__1.txt │ ├── bolt__parse_183__0.txt │ ├── bolt__parse_184__0.txt │ ├── bolt__parse_184__1.txt │ ├── bolt__parse_185__0.txt │ ├── bolt__parse_185__1.txt │ ├── bolt__parse_186__0.txt │ ├── bolt__parse_186__1.txt │ ├── bolt__parse_187__0.txt │ ├── bolt__parse_188__0.txt │ ├── bolt__parse_189__0.txt │ ├── bolt__parse_18__0.txt │ ├── bolt__parse_190__0.txt │ ├── bolt__parse_191__0.txt │ ├── bolt__parse_192__0.txt │ ├── bolt__parse_192__1.txt │ ├── bolt__parse_193__0.txt │ ├── bolt__parse_193__1.txt │ ├── bolt__parse_194__0.txt │ ├── bolt__parse_194__1.txt │ ├── bolt__parse_195__0.txt │ ├── bolt__parse_196__0.txt │ ├── bolt__parse_196__1.txt │ ├── bolt__parse_197__0.txt │ ├── bolt__parse_197__1.txt │ ├── bolt__parse_198__0.txt │ ├── bolt__parse_198__1.txt │ ├── bolt__parse_199__0.txt │ ├── bolt__parse_199__1.txt │ ├── bolt__parse_19__0.txt │ ├── bolt__parse_1__0.txt │ ├── bolt__parse_1__1.txt │ ├── bolt__parse_200__0.txt │ ├── bolt__parse_201__0.txt │ ├── bolt__parse_201__1.txt │ ├── bolt__parse_202__0.txt │ ├── bolt__parse_202__1.txt │ ├── bolt__parse_203__0.txt │ ├── bolt__parse_203__1.txt │ ├── bolt__parse_204__0.txt │ ├── bolt__parse_205__0.txt │ ├── bolt__parse_205__1.txt │ ├── bolt__parse_206__0.txt │ ├── bolt__parse_206__1.txt │ ├── bolt__parse_207__0.txt │ ├── bolt__parse_207__1.txt │ ├── bolt__parse_208__0.txt │ ├── bolt__parse_208__1.txt │ ├── bolt__parse_209__0.txt │ ├── bolt__parse_209__1.txt │ ├── bolt__parse_20__0.txt │ ├── bolt__parse_20__1.txt │ ├── bolt__parse_210__0.txt │ ├── bolt__parse_210__1.txt │ ├── bolt__parse_211__0.txt │ ├── bolt__parse_211__1.txt │ ├── bolt__parse_212__0.txt │ ├── bolt__parse_213__0.txt │ ├── bolt__parse_214__0.txt │ ├── bolt__parse_215__0.txt │ ├── bolt__parse_215__1.txt │ ├── bolt__parse_216__0.txt │ ├── bolt__parse_216__1.txt │ ├── bolt__parse_217__0.txt │ ├── bolt__parse_217__1.txt │ ├── bolt__parse_218__0.txt │ ├── bolt__parse_218__1.txt │ ├── bolt__parse_219__0.txt │ ├── bolt__parse_219__1.txt │ ├── bolt__parse_21__0.txt │ ├── bolt__parse_21__1.txt │ ├── bolt__parse_220__0.txt │ ├── bolt__parse_220__1.txt │ ├── bolt__parse_221__0.txt │ ├── bolt__parse_221__1.txt │ ├── bolt__parse_222__0.txt │ ├── bolt__parse_223__0.txt │ ├── bolt__parse_224__0.txt │ ├── bolt__parse_225__0.txt │ ├── bolt__parse_226__0.txt │ ├── bolt__parse_226__1.txt │ ├── bolt__parse_227__0.txt │ ├── bolt__parse_227__1.txt │ ├── bolt__parse_228__0.txt │ ├── bolt__parse_228__1.txt │ ├── bolt__parse_229__0.txt │ ├── bolt__parse_229__1.txt │ ├── bolt__parse_22__0.txt │ ├── bolt__parse_22__1.txt │ ├── bolt__parse_230__0.txt │ ├── bolt__parse_231__0.txt │ ├── bolt__parse_231__1.txt │ ├── bolt__parse_232__0.txt │ ├── bolt__parse_233__0.txt │ ├── bolt__parse_233__1.txt │ ├── bolt__parse_234__0.txt │ ├── bolt__parse_234__1.txt │ ├── bolt__parse_235__0.txt │ ├── bolt__parse_235__1.txt │ ├── bolt__parse_236__0.txt │ ├── bolt__parse_237__0.txt │ ├── bolt__parse_237__1.txt │ ├── bolt__parse_238__0.txt │ ├── bolt__parse_238__1.txt │ ├── bolt__parse_239__0.txt │ ├── bolt__parse_239__1.txt │ ├── bolt__parse_23__0.txt │ ├── bolt__parse_23__1.txt │ ├── bolt__parse_240__0.txt │ ├── bolt__parse_241__0.txt │ ├── bolt__parse_241__1.txt │ ├── bolt__parse_242__0.txt │ ├── bolt__parse_243__0.txt │ ├── bolt__parse_243__1.txt │ ├── bolt__parse_244__0.txt │ ├── bolt__parse_244__1.txt │ ├── bolt__parse_245__0.txt │ ├── bolt__parse_245__1.txt │ ├── bolt__parse_246__0.txt │ ├── bolt__parse_246__1.txt │ ├── bolt__parse_247__0.txt │ ├── bolt__parse_247__1.txt │ ├── bolt__parse_248__0.txt │ ├── bolt__parse_248__1.txt │ ├── bolt__parse_249__0.txt │ ├── bolt__parse_249__1.txt │ ├── bolt__parse_24__0.txt │ ├── bolt__parse_24__1.txt │ ├── bolt__parse_250__0.txt │ ├── bolt__parse_250__1.txt │ ├── bolt__parse_251__0.txt │ ├── bolt__parse_251__1.txt │ ├── bolt__parse_252__0.txt │ ├── bolt__parse_253__0.txt │ ├── bolt__parse_254__0.txt │ ├── bolt__parse_254__1.txt │ ├── bolt__parse_255__0.txt │ ├── bolt__parse_255__1.txt │ ├── bolt__parse_256__0.txt │ ├── bolt__parse_257__0.txt │ ├── bolt__parse_258__0.txt │ ├── bolt__parse_259__0.txt │ ├── bolt__parse_259__1.txt │ ├── bolt__parse_25__0.txt │ ├── bolt__parse_25__1.txt │ ├── bolt__parse_260__0.txt │ ├── bolt__parse_261__0.txt │ ├── bolt__parse_262__0.txt │ ├── bolt__parse_262__1.txt │ ├── bolt__parse_263__0.txt │ ├── bolt__parse_263__1.txt │ ├── bolt__parse_264__0.txt │ ├── bolt__parse_264__1.txt │ ├── bolt__parse_265__0.txt │ ├── bolt__parse_265__1.txt │ ├── bolt__parse_266__0.txt │ ├── bolt__parse_267__0.txt │ ├── bolt__parse_268__0.txt │ ├── bolt__parse_269__0.txt │ ├── bolt__parse_26__0.txt │ ├── bolt__parse_26__1.txt │ ├── bolt__parse_270__0.txt │ ├── bolt__parse_271__0.txt │ ├── bolt__parse_272__0.txt │ ├── bolt__parse_273__0.txt │ ├── bolt__parse_273__1.txt │ ├── bolt__parse_274__0.txt │ ├── bolt__parse_274__1.txt │ ├── bolt__parse_275__0.txt │ ├── bolt__parse_275__1.txt │ ├── bolt__parse_276__0.txt │ ├── bolt__parse_276__1.txt │ ├── bolt__parse_277__0.txt │ ├── bolt__parse_278__0.txt │ ├── bolt__parse_278__1.txt │ ├── bolt__parse_279__0.txt │ ├── bolt__parse_279__1.txt │ ├── bolt__parse_27__0.txt │ ├── bolt__parse_280__0.txt │ ├── bolt__parse_280__1.txt │ ├── bolt__parse_281__0.txt │ ├── bolt__parse_281__1.txt │ ├── bolt__parse_282__0.txt │ ├── bolt__parse_282__1.txt │ ├── bolt__parse_283__0.txt │ ├── bolt__parse_283__1.txt │ ├── bolt__parse_284__0.txt │ ├── bolt__parse_284__1.txt │ ├── bolt__parse_285__0.txt │ ├── bolt__parse_285__1.txt │ ├── bolt__parse_286__0.txt │ ├── bolt__parse_286__1.txt │ ├── bolt__parse_287__0.txt │ ├── bolt__parse_287__1.txt │ ├── bolt__parse_288__0.txt │ ├── bolt__parse_288__1.txt │ ├── bolt__parse_289__0.txt │ ├── bolt__parse_289__1.txt │ ├── bolt__parse_28__0.txt │ ├── bolt__parse_290__0.txt │ ├── bolt__parse_290__1.txt │ ├── bolt__parse_291__0.txt │ ├── bolt__parse_291__1.txt │ ├── bolt__parse_292__0.txt │ ├── bolt__parse_292__1.txt │ ├── bolt__parse_293__0.txt │ ├── bolt__parse_293__1.txt │ ├── bolt__parse_294__0.txt │ ├── bolt__parse_294__1.txt │ ├── bolt__parse_295__0.txt │ ├── bolt__parse_296__0.txt │ ├── bolt__parse_297__0.txt │ ├── bolt__parse_298__0.txt │ ├── bolt__parse_299__0.txt │ ├── bolt__parse_29__0.txt │ ├── bolt__parse_29__1.txt │ ├── bolt__parse_2__0.txt │ ├── bolt__parse_2__1.txt │ ├── bolt__parse_300__0.txt │ ├── bolt__parse_301__0.txt │ ├── bolt__parse_302__0.txt │ ├── bolt__parse_303__0.txt │ ├── bolt__parse_304__0.txt │ ├── bolt__parse_305__0.txt │ ├── bolt__parse_306__0.txt │ ├── bolt__parse_307__0.txt │ ├── bolt__parse_308__0.txt │ ├── bolt__parse_309__0.txt │ ├── bolt__parse_30__0.txt │ ├── bolt__parse_310__0.txt │ ├── bolt__parse_311__0.txt │ ├── bolt__parse_312__0.txt │ ├── bolt__parse_313__0.txt │ ├── bolt__parse_313__1.txt │ ├── bolt__parse_314__0.txt │ ├── bolt__parse_314__1.txt │ ├── bolt__parse_315__0.txt │ ├── bolt__parse_315__1.txt │ ├── bolt__parse_316__0.txt │ ├── bolt__parse_316__1.txt │ ├── bolt__parse_317__0.txt │ ├── bolt__parse_317__1.txt │ ├── bolt__parse_318__0.txt │ ├── bolt__parse_318__1.txt │ ├── bolt__parse_319__0.txt │ ├── bolt__parse_319__1.txt │ ├── bolt__parse_31__0.txt │ ├── bolt__parse_320__0.txt │ ├── bolt__parse_320__1.txt │ ├── bolt__parse_321__0.txt │ ├── bolt__parse_321__1.txt │ ├── bolt__parse_322__0.txt │ ├── bolt__parse_322__1.txt │ ├── bolt__parse_323__0.txt │ ├── bolt__parse_323__1.txt │ ├── bolt__parse_324__0.txt │ ├── bolt__parse_324__1.txt │ ├── bolt__parse_325__0.txt │ ├── bolt__parse_326__0.txt │ ├── bolt__parse_327__0.txt │ ├── bolt__parse_327__1.txt │ ├── bolt__parse_328__0.txt │ ├── bolt__parse_328__1.txt │ ├── bolt__parse_329__0.txt │ ├── bolt__parse_329__1.txt │ ├── bolt__parse_32__0.txt │ ├── bolt__parse_32__1.txt │ ├── bolt__parse_330__0.txt │ ├── bolt__parse_330__1.txt │ ├── bolt__parse_331__0.txt │ ├── bolt__parse_331__1.txt │ ├── bolt__parse_332__0.txt │ ├── bolt__parse_332__1.txt │ ├── bolt__parse_333__0.txt │ ├── bolt__parse_333__1.txt │ ├── bolt__parse_334__0.txt │ ├── bolt__parse_334__1.txt │ ├── bolt__parse_335__0.txt │ ├── bolt__parse_336__0.txt │ ├── bolt__parse_336__1.txt │ ├── bolt__parse_337__0.txt │ ├── bolt__parse_337__1.txt │ ├── bolt__parse_338__0.txt │ ├── bolt__parse_338__1.txt │ ├── bolt__parse_339__0.txt │ ├── bolt__parse_33__0.txt │ ├── bolt__parse_33__1.txt │ ├── bolt__parse_340__0.txt │ ├── bolt__parse_340__1.txt │ ├── bolt__parse_341__0.txt │ ├── bolt__parse_341__1.txt │ ├── bolt__parse_342__0.txt │ ├── bolt__parse_343__0.txt │ ├── bolt__parse_343__1.txt │ ├── bolt__parse_344__0.txt │ ├── bolt__parse_344__1.txt │ ├── bolt__parse_345__0.txt │ ├── bolt__parse_345__1.txt │ ├── bolt__parse_346__0.txt │ ├── bolt__parse_346__1.txt │ ├── bolt__parse_347__0.txt │ ├── bolt__parse_348__0.txt │ ├── bolt__parse_349__0.txt │ ├── bolt__parse_34__0.txt │ ├── bolt__parse_34__1.txt │ ├── bolt__parse_350__0.txt │ ├── bolt__parse_351__0.txt │ ├── bolt__parse_352__0.txt │ ├── bolt__parse_353__0.txt │ ├── bolt__parse_354__0.txt │ ├── bolt__parse_354__1.txt │ ├── bolt__parse_355__0.txt │ ├── bolt__parse_355__1.txt │ ├── bolt__parse_356__0.txt │ ├── bolt__parse_356__1.txt │ ├── bolt__parse_357__0.txt │ ├── bolt__parse_357__1.txt │ ├── bolt__parse_358__0.txt │ ├── bolt__parse_359__0.txt │ ├── bolt__parse_359__1.txt │ ├── bolt__parse_35__0.txt │ ├── bolt__parse_35__1.txt │ ├── bolt__parse_360__0.txt │ ├── bolt__parse_360__1.txt │ ├── bolt__parse_361__0.txt │ ├── bolt__parse_362__0.txt │ ├── bolt__parse_362__1.txt │ ├── bolt__parse_363__0.txt │ ├── bolt__parse_363__1.txt │ ├── bolt__parse_364__0.txt │ ├── bolt__parse_365__0.txt │ ├── bolt__parse_365__1.txt │ ├── bolt__parse_366__0.txt │ ├── bolt__parse_366__1.txt │ ├── bolt__parse_367__0.txt │ ├── bolt__parse_367__1.txt │ ├── bolt__parse_368__0.txt │ ├── bolt__parse_369__0.txt │ ├── bolt__parse_369__1.txt │ ├── bolt__parse_36__0.txt │ ├── bolt__parse_370__0.txt │ ├── bolt__parse_370__1.txt │ ├── bolt__parse_371__0.txt │ ├── bolt__parse_371__1.txt │ ├── bolt__parse_372__0.txt │ ├── bolt__parse_372__1.txt │ ├── bolt__parse_373__0.txt │ ├── bolt__parse_373__1.txt │ ├── bolt__parse_374__0.txt │ ├── bolt__parse_374__1.txt │ ├── bolt__parse_375__0.txt │ ├── bolt__parse_375__1.txt │ ├── bolt__parse_376__0.txt │ ├── bolt__parse_376__1.txt │ ├── bolt__parse_377__0.txt │ ├── bolt__parse_377__1.txt │ ├── bolt__parse_378__0.txt │ ├── bolt__parse_378__1.txt │ ├── bolt__parse_379__0.txt │ ├── bolt__parse_379__1.txt │ ├── bolt__parse_37__0.txt │ ├── bolt__parse_380__0.txt │ ├── bolt__parse_380__1.txt │ ├── bolt__parse_38__0.txt │ ├── bolt__parse_39__0.txt │ ├── bolt__parse_3__0.txt │ ├── bolt__parse_3__1.txt │ ├── bolt__parse_40__0.txt │ ├── bolt__parse_41__0.txt │ ├── bolt__parse_41__1.txt │ ├── bolt__parse_42__0.txt │ ├── bolt__parse_42__1.txt │ ├── bolt__parse_43__0.txt │ ├── bolt__parse_43__1.txt │ ├── bolt__parse_44__0.txt │ ├── bolt__parse_44__1.txt │ ├── bolt__parse_45__0.txt │ ├── bolt__parse_45__1.txt │ ├── bolt__parse_46__0.txt │ ├── bolt__parse_46__1.txt │ ├── bolt__parse_47__0.txt │ ├── bolt__parse_47__1.txt │ ├── bolt__parse_48__0.txt │ ├── bolt__parse_49__0.txt │ ├── bolt__parse_49__1.txt │ ├── bolt__parse_4__0.txt │ ├── bolt__parse_4__1.txt │ ├── bolt__parse_50__0.txt │ ├── bolt__parse_50__1.txt │ ├── bolt__parse_51__0.txt │ ├── bolt__parse_51__1.txt │ ├── bolt__parse_52__0.txt │ ├── bolt__parse_53__0.txt │ ├── bolt__parse_53__1.txt │ ├── bolt__parse_54__0.txt │ ├── bolt__parse_55__0.txt │ ├── bolt__parse_55__1.txt │ ├── bolt__parse_56__0.txt │ ├── bolt__parse_57__0.txt │ ├── bolt__parse_57__1.txt │ ├── bolt__parse_58__0.txt │ ├── bolt__parse_59__0.txt │ ├── bolt__parse_5__0.txt │ ├── bolt__parse_5__1.txt │ ├── bolt__parse_60__0.txt │ ├── bolt__parse_61__0.txt │ ├── bolt__parse_62__0.txt │ ├── bolt__parse_62__1.txt │ ├── bolt__parse_63__0.txt │ ├── bolt__parse_63__1.txt │ ├── bolt__parse_64__0.txt │ ├── bolt__parse_64__1.txt │ ├── bolt__parse_65__0.txt │ ├── bolt__parse_65__1.txt │ ├── bolt__parse_66__0.txt │ ├── bolt__parse_66__1.txt │ ├── bolt__parse_67__0.txt │ ├── bolt__parse_67__1.txt │ ├── bolt__parse_68__0.txt │ ├── bolt__parse_68__1.txt │ ├── bolt__parse_69__0.txt │ ├── bolt__parse_69__1.txt │ ├── bolt__parse_6__0.txt │ ├── bolt__parse_6__1.txt │ ├── bolt__parse_70__0.txt │ ├── bolt__parse_70__1.txt │ ├── bolt__parse_71__0.txt │ ├── bolt__parse_71__1.txt │ ├── bolt__parse_72__0.txt │ ├── bolt__parse_72__1.txt │ ├── bolt__parse_73__0.txt │ ├── bolt__parse_74__0.txt │ ├── bolt__parse_75__0.txt │ ├── bolt__parse_76__0.txt │ ├── bolt__parse_77__0.txt │ ├── bolt__parse_77__1.txt │ ├── bolt__parse_78__0.txt │ ├── bolt__parse_79__0.txt │ ├── bolt__parse_7__0.txt │ ├── bolt__parse_7__1.txt │ ├── bolt__parse_80__0.txt │ ├── bolt__parse_81__0.txt │ ├── bolt__parse_81__1.txt │ ├── bolt__parse_82__0.txt │ ├── bolt__parse_82__1.txt │ ├── bolt__parse_83__0.txt │ ├── bolt__parse_84__0.txt │ ├── bolt__parse_84__1.txt │ ├── bolt__parse_85__0.txt │ ├── bolt__parse_86__0.txt │ ├── bolt__parse_87__0.txt │ ├── bolt__parse_87__1.txt │ ├── bolt__parse_88__0.txt │ ├── bolt__parse_89__0.txt │ ├── bolt__parse_89__1.txt │ ├── bolt__parse_8__0.txt │ ├── bolt__parse_8__1.txt │ ├── bolt__parse_90__0.txt │ ├── bolt__parse_91__0.txt │ ├── bolt__parse_91__1.txt │ ├── bolt__parse_92__0.txt │ ├── bolt__parse_92__1.txt │ ├── bolt__parse_93__0.txt │ ├── bolt__parse_93__1.txt │ ├── bolt__parse_94__0.txt │ ├── bolt__parse_94__1.txt │ ├── bolt__parse_95__0.txt │ ├── bolt__parse_95__1.txt │ ├── bolt__parse_96__0.txt │ ├── bolt__parse_96__1.txt │ ├── bolt__parse_97__0.txt │ ├── bolt__parse_97__1.txt │ ├── bolt__parse_98__0.txt │ ├── bolt__parse_99__0.txt │ ├── bolt__parse_9__0.txt │ ├── bolt__parse_9__1.txt │ ├── examples__build_bolt_1_20__0.pack.md │ ├── examples__build_bolt_assets__0.pack.md │ ├── examples__build_bolt_basic__0.pack.md │ ├── examples__build_bolt_chained_comp__0.pack.md │ ├── examples__build_bolt_chicken__0.pack.md │ ├── examples__build_bolt_circular__0.pack.md │ ├── examples__build_bolt_class__0.pack.md │ ├── examples__build_bolt_compile_cached__0.pack.md │ ├── examples__build_bolt_custom_provider__0.pack.md │ ├── examples__build_bolt_debug__0.pack.md │ ├── examples__build_bolt_defer__0.pack.md │ ├── examples__build_bolt_docstring__0.pack.md │ ├── examples__build_bolt_flat__0.pack.md │ ├── examples__build_bolt_function_signature__0.pack.md │ ├── examples__build_bolt_generated__0.pack.md │ ├── examples__build_bolt_json__0.pack.md │ ├── examples__build_bolt_lazy__0.pack.md │ ├── examples__build_bolt_lectern_prelude__0.pack.md │ ├── examples__build_bolt_loop__0.pack.md │ ├── examples__build_bolt_macro__0.pack.md │ ├── examples__build_bolt_macro_perf__0.pack.md │ ├── examples__build_bolt_memo2__0.pack.md │ ├── examples__build_bolt_memo3__0.pack.md │ ├── examples__build_bolt_memo4__0.pack.md │ ├── examples__build_bolt_memo__0.pack.md │ ├── examples__build_bolt_merge__0.pack.md │ ├── examples__build_bolt_nested_location__0.pack.md │ ├── examples__build_bolt_nesting__0.pack.md │ ├── examples__build_bolt_order__0.pack.md │ ├── examples__build_bolt_overgen__0.pack.md │ ├── examples__build_bolt_overlay__0.pack.md │ ├── examples__build_bolt_patchers__0.pack.md │ ├── examples__build_bolt_prelude__0.pack.md │ ├── examples__build_bolt_proc_macro__0.pack.md │ ├── examples__build_bolt_sample_ui__0.pack.md │ ├── examples__build_bolt_shadow_global__0.pack.md │ ├── examples__build_bolt_strip_final_newline__0.pack.md │ ├── examples__build_bolt_summon__0.pack.md │ ├── examples__build_bolt_too_many_statically_nested_blocks__0.pack.md │ ├── examples__build_bolt_type_annotations__0.pack.md │ ├── sandbox__run_0__0.txt │ ├── sandbox__run_1__0.txt │ ├── sandbox__run_2__0.txt │ ├── sandbox__run_3__0.txt │ ├── sandbox__run_4__0.txt │ ├── sandbox__run_5__0.txt │ ├── sandbox__run_6__0.txt │ ├── sandbox__run_7__0.txt │ ├── sandbox__run_8__0.txt │ └── spec__prototypes__0.json ├── test_bolt.py ├── test_examples.py ├── test_sandbox.py ├── test_semantics.py └── test_spec.py └── typings └── pathspec.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: 2 | - vberlier 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | - package-ecosystem: "pip" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | 9 | - package-ecosystem: "npm" 10 | directory: "/" 11 | schedule: 12 | interval: "weekly" 13 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-python.python", 4 | "ms-python.vscode-pylance", 5 | "ms-python.black-formatter", 6 | "tamasfe.even-better-toml" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.languageServer": "Pylance", 3 | "[python]": { 4 | "editor.tabSize": 4, 5 | "editor.formatOnSave": true, 6 | "editor.formatOnType": false, 7 | "editor.formatOnPaste": false, 8 | "editor.codeActionsOnSave": { 9 | "source.organizeImports": "explicit" 10 | }, 11 | "editor.defaultFormatter": "ms-python.black-formatter" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /bolt/__init__.py: -------------------------------------------------------------------------------- 1 | __version__ = "0.49.2" 2 | 3 | 4 | from .ast import * 5 | from .codegen import * 6 | from .emit import * 7 | from .helpers import * 8 | from .loop_info import * 9 | from .memo import * 10 | from .module import * 11 | from .parse import * 12 | from .plugin import * 13 | from .runtime import * 14 | from .semantics import * 15 | -------------------------------------------------------------------------------- /bolt/contrib/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeet/bolt/cf98369e2f62e21e1e95d5f071d71e5b894b5612/bolt/contrib/__init__.py -------------------------------------------------------------------------------- /bolt/plugin.py: -------------------------------------------------------------------------------- 1 | __all__ = [ 2 | "bolt", 3 | "beet_default", 4 | ] 5 | 6 | 7 | from beet import Context, ListOption, configurable 8 | from pydantic.v1 import BaseModel 9 | 10 | from .runtime import Runtime 11 | 12 | 13 | class BoltOptions(BaseModel): 14 | entrypoint: ListOption[str] = ListOption() 15 | prelude: ListOption[str] = ListOption() 16 | 17 | 18 | def beet_default(ctx: Context): 19 | ctx.require(bolt) 20 | 21 | 22 | @configurable(validator=BoltOptions) 23 | def bolt(ctx: Context, opts: BoltOptions): 24 | """Plugin for configuring bolt.""" 25 | runtime = ctx.inject(Runtime) 26 | runtime.evaluate.add_entrypoint(opts.entrypoint.entries()) 27 | runtime.modules.add_prelude(opts.prelude.entries()) 28 | -------------------------------------------------------------------------------- /bolt/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeet/bolt/cf98369e2f62e21e1e95d5f071d71e5b894b5612/bolt/py.typed -------------------------------------------------------------------------------- /bolt/resources/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeet/bolt/cf98369e2f62e21e1e95d5f071d71e5b894b5612/bolt/resources/__init__.py -------------------------------------------------------------------------------- /examples/bolt_1_20/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_1_20/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | def f(): 2 | execute if entity @e[type=pig] run return 123 3 | n = 77 4 | execute return n 5 | return 99999 6 | 7 | say f() 8 | 9 | execute function ./thing: 10 | return 42 11 | 12 | return 0 13 | -------------------------------------------------------------------------------- /examples/bolt_assets/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | resource_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | meta: 8 | bolt: 9 | entrypoint: "*" 10 | -------------------------------------------------------------------------------- /examples/bolt_assets/src/assets/demo/modules/foo.bolt: -------------------------------------------------------------------------------- 1 | model minecraft:block/stone {"parent": "block/cube"} 2 | -------------------------------------------------------------------------------- /examples/bolt_basic/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: [src] 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_basic/random_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": 42 3 | } 4 | -------------------------------------------------------------------------------- /examples/bolt_basic/src/data/demo/functions/import_a.mcfunction: -------------------------------------------------------------------------------- 1 | from bolt import Runtime 2 | 3 | runtime = ctx.inject(Runtime) 4 | 5 | foo = 42 6 | 7 | def callback(): 8 | return foo 9 | 10 | def loga(f): 11 | runtime.modules.current.namespace["bar"] *= 2 12 | say __name__ 13 | say runtime.modules.current_path 14 | say f() 15 | 16 | from ./import_b import logb 17 | 18 | logb(callback) 19 | -------------------------------------------------------------------------------- /examples/bolt_basic/src/data/demo/functions/import_b.mcfunction: -------------------------------------------------------------------------------- 1 | from bolt import Runtime 2 | 3 | runtime = ctx.inject(Runtime) 4 | 5 | bar = 7 6 | 7 | def callback(): 8 | return bar 9 | 10 | def logb(f): 11 | runtime.modules.current.namespace["foo"] *= 2 12 | say __name__ 13 | say runtime.modules.current_path 14 | say f() 15 | 16 | from ./import_a import loga 17 | 18 | loga(callback) 19 | -------------------------------------------------------------------------------- /examples/bolt_basic/src/data/demo/functions/thing.mcfunction: -------------------------------------------------------------------------------- 1 | from mecha import Mecha 2 | from bolt import Runtime 3 | 4 | mc = ctx.inject(Mecha) 5 | runtime = ctx.inject(Runtime) 6 | 7 | def do_stuff(a, b): 8 | import math 9 | return a + math.cos(b) 10 | 11 | def call_recursive(): 12 | if score @s loop_again matches 1 function runtime.modules.current_path 13 | 14 | def raw(cmd): 15 | runtime.commands.append(mc.parse(cmd, using="command")) 16 | -------------------------------------------------------------------------------- /examples/bolt_basic/src/data/demo/functions/utils.mcfunction: -------------------------------------------------------------------------------- 1 | say this doesn't conflict with the demo:utils module 2 | -------------------------------------------------------------------------------- /examples/bolt_basic/src/data/demo/modules/utils.bolt: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | def something(): 4 | say f"this is from {__name__}" 5 | 6 | def load_storage(storage_id, filename): 7 | path = ctx.directory / filename 8 | merge function_tag minecraft:load {"values": [generate_path("load_storage")]} 9 | append function generate_path("load_storage"): 10 | data merge storage storage_id json.loads(path.read_text()) 11 | say json loaded! 12 | -------------------------------------------------------------------------------- /examples/bolt_chained_comp/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_chicken/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: [src] 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_chicken/src/data/demo/functions/chicken.mcfunction: -------------------------------------------------------------------------------- 1 | from ./utils import summon_chicken_army 2 | 3 | say Go forth, my minions! 4 | summon_chicken_army(16) 5 | -------------------------------------------------------------------------------- /examples/bolt_chicken/src/data/demo/modules/utils.bolt: -------------------------------------------------------------------------------- 1 | infinite_invisibility = { 2 | Id: 14, 3 | Duration: 999999, 4 | Amplifier: 1, 5 | ShowParticles: false, 6 | } 7 | 8 | def summon_chicken_army(n): 9 | for i in range(n): 10 | summon chicken ~i ~ ~ { 11 | Tags: [f"quack{i}"], 12 | IsChickenJockey: true, 13 | Passengers: [{ 14 | id: zombie, 15 | IsBaby: true, 16 | ActiveEffects: [infinite_invisibility] 17 | }] 18 | } 19 | -------------------------------------------------------------------------------- /examples/bolt_circular/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: 5 | data/demo/modules: src 6 | pipeline: 7 | - mecha 8 | meta: 9 | bolt: 10 | entrypoint: "demo:main" 11 | -------------------------------------------------------------------------------- /examples/bolt_circular/src/bar.bolt: -------------------------------------------------------------------------------- 1 | import ./foo as foo 2 | 3 | VALUE = 33 4 | 5 | def b(): 6 | return foo.VALUE 7 | -------------------------------------------------------------------------------- /examples/bolt_circular/src/foo.bolt: -------------------------------------------------------------------------------- 1 | import ./bar as bar 2 | 3 | VALUE = 42 4 | 5 | def a(): 6 | return bar.VALUE 7 | -------------------------------------------------------------------------------- /examples/bolt_circular/src/main.bolt: -------------------------------------------------------------------------------- 1 | from ./foo import a 2 | from ./bar import b 3 | 4 | function ./thing: 5 | say a() 6 | say b() 7 | -------------------------------------------------------------------------------- /examples/bolt_class/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_class/src/data/demo/functions/pydantic.mcfunction: -------------------------------------------------------------------------------- 1 | from pydantic.v1 import BaseModel 2 | 3 | class Model(BaseModel, frozen=True): 4 | a: int 5 | b: str 6 | 7 | say Model(a="123", b="123").json() 8 | -------------------------------------------------------------------------------- /examples/bolt_compile_cached/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | - compile_cached 8 | -------------------------------------------------------------------------------- /examples/bolt_compile_cached/cached/slow.mcfunction: -------------------------------------------------------------------------------- 1 | for i in range(10): 2 | say f"something slow {i}" 3 | -------------------------------------------------------------------------------- /examples/bolt_compile_cached/compile_cached.py: -------------------------------------------------------------------------------- 1 | from beet import Context, sandbox, subproject 2 | 3 | 4 | def beet_default(ctx: Context): 5 | ctx.require(sandbox(compile_cached)) 6 | 7 | 8 | def compile_cached(ctx: Context): 9 | cached_data_pack = ctx.cache["compile_cached"].directory / "data_pack" 10 | 11 | if cached_data_pack.is_dir(): 12 | ctx.data.load(cached_data_pack) 13 | else: 14 | ctx.require( 15 | subproject( 16 | { 17 | "require": ["bolt"], 18 | "data_pack": {"load": {"data/demo/functions/cached": "cached"}}, 19 | "pipeline": ["mecha"], 20 | } 21 | ) 22 | ) 23 | ctx.data.save(path=cached_data_pack, overwrite=True) 24 | -------------------------------------------------------------------------------- /examples/bolt_compile_cached/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | say hello 2 | -------------------------------------------------------------------------------- /examples/bolt_custom_provider/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - custom_provider 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | - custom_provider.remove_custom_modules 8 | -------------------------------------------------------------------------------- /examples/bolt_custom_provider/custom_provider.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from beet import Context, NamespaceFileScope, TextFile 4 | from mecha import FileTypeCompilationUnitProvider, Mecha 5 | 6 | 7 | class Custom(TextFile): 8 | scope: ClassVar[NamespaceFileScope] = ("custom",) 9 | extension: ClassVar[str] = ".bolt" 10 | 11 | 12 | def beet_default(ctx: Context): 13 | ctx.data.extend_namespace.append(Custom) 14 | 15 | ctx.require("bolt") 16 | 17 | mc = ctx.inject(Mecha) 18 | mc.providers = [FileTypeCompilationUnitProvider([Custom])] 19 | 20 | 21 | def remove_custom_modules(ctx: Context): 22 | for pack in [ctx.data, *ctx.data.overlays.values()]: 23 | pack[Custom].clear() 24 | -------------------------------------------------------------------------------- /examples/bolt_custom_provider/src/data/demo/custom/stuff.bolt: -------------------------------------------------------------------------------- 1 | function ~/abc: 2 | say 123 3 | -------------------------------------------------------------------------------- /examples/bolt_custom_provider/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | value = 123 2 | print(value) 3 | say this should be left untouched 4 | -------------------------------------------------------------------------------- /examples/bolt_debug/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt.contrib.debug_codegen 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_debug/src/data/demo/functions/bar.mcfunction: -------------------------------------------------------------------------------- 1 | say hello without anything fancy 2 | -------------------------------------------------------------------------------- /examples/bolt_debug/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | def say_hello(): 2 | say hello 3 | 4 | say_hello() 5 | -------------------------------------------------------------------------------- /examples/bolt_defer/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_defer/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | from mecha import AstString 2 | from bolt.contrib.defer import Defer, AstDefer 3 | 4 | defer = ctx.inject(Defer) 5 | 6 | counter = 0 7 | def foo(): 8 | global counter 9 | say counter 10 | counter += 1 11 | 12 | say start 13 | foo() 14 | foo() 15 | defer(foo) 16 | defer(foo) 17 | say end 18 | 19 | counter = 7 20 | 21 | @defer 22 | def bar(): 23 | function ./bar: 24 | defer(foo) 25 | global counter 26 | counter *= 2 27 | 28 | def format_deferred_tag(): 29 | return AstString(value=f"thing{counter}") 30 | 31 | tag @p add AstDefer(callback=format_deferred_tag) 32 | -------------------------------------------------------------------------------- /examples/bolt_docstring/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_docstring/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | value = """ 2 | hello 3 | world 4 | """ 5 | 6 | say repr(value) 7 | 8 | def f(): 9 | """My function""" 10 | return 42 11 | 12 | say f() 13 | say f.__doc__ 14 | 15 | def g(a=123): 16 | """My other function""" 17 | return a 18 | 19 | say g() 20 | say g.__doc__ 21 | 22 | class A: 23 | """This is a class. 24 | 25 | It doesn't do anything. 26 | """ 27 | 28 | say repr(A.__doc__) 29 | 30 | value = r""" 31 | foo\n\nbar 32 | """ 33 | 34 | say repr(value) 35 | -------------------------------------------------------------------------------- /examples/bolt_flat/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: 5 | data/demo/modules: "@demo" 6 | pipeline: 7 | - mecha 8 | meta: 9 | bolt: 10 | entrypoint: "demo:main" 11 | -------------------------------------------------------------------------------- /examples/bolt_flat/demo/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeet/bolt/cf98369e2f62e21e1e95d5f071d71e5b894b5612/examples/bolt_flat/demo/__init__.py -------------------------------------------------------------------------------- /examples/bolt_flat/demo/main.bolt: -------------------------------------------------------------------------------- 1 | from demo.math import add 2 | 3 | function ./foo: 4 | say add(2, 3) 5 | 6 | function ./oby: 7 | stat_list = [ 8 | "damage", 9 | "attack_speed", 10 | "multishot", 11 | "piercing" 12 | ] 13 | 14 | if data storage firework:temp data.item.tag.aftermath.stats: 15 | 16 | for stat in stat_list: 17 | if data storage firework:temp f'data.item.tag.aftermath.stats.{stat}': 18 | say f'{stat}, present' 19 | 20 | unless data storage firework:temp data.item.tag.aftermath.stats: 21 | say 'hi' 22 | -------------------------------------------------------------------------------- /examples/bolt_flat/demo/math.py: -------------------------------------------------------------------------------- 1 | def add(a: int, b: int) -> int: 2 | return a + b 3 | -------------------------------------------------------------------------------- /examples/bolt_function_signature/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: 5 | data/demo/functions/foo.mcfunction: "foo.mcfunction" 6 | pipeline: 7 | - mecha 8 | -------------------------------------------------------------------------------- /examples/bolt_function_signature/foo.mcfunction: -------------------------------------------------------------------------------- 1 | def f(): 2 | pass 3 | 4 | def f(a): 5 | pass 6 | 7 | def f(a=1): 8 | pass 9 | 10 | def f(a=1,): 11 | pass 12 | 13 | def f(a=1, /): 14 | pass 15 | 16 | def f(a, /, b): 17 | pass 18 | 19 | def f(a=1, /, b=2): 20 | pass 21 | 22 | def f(a=1, /, b=2, *args): 23 | pass 24 | 25 | def f(a, /, b, *, c): 26 | pass 27 | 28 | def f(a=1, /, b=2, *, c=3): 29 | pass 30 | 31 | def f(a=1, /, b=2, *, c=3, **kwargs): 32 | pass 33 | 34 | def f(a=1, /, b=2, *args, c=3, **kwargs): 35 | pass 36 | -------------------------------------------------------------------------------- /examples/bolt_generated/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: [src] 5 | pipeline: 6 | - demo 7 | - mecha 8 | -------------------------------------------------------------------------------- /examples/bolt_generated/demo.py: -------------------------------------------------------------------------------- 1 | from beet import Context, Function 2 | 3 | generated_code = """ 4 | execute if score #smithed.core load.status matches 1 function ./0: 5 | data merge storage smithed:log {message:'["Could not find ",{"text":"#smithed.prevent_aggression 0.0.1","color":"red"}]',type:'ERROR'} 6 | function #smithed:core/pub/technical/tools/log 7 | """ 8 | 9 | 10 | def beet_default(ctx: Context): 11 | ctx.data["demo:generated"] = Function(generated_code) 12 | -------------------------------------------------------------------------------- /examples/bolt_generated/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | a = 123 2 | say a 3 | -------------------------------------------------------------------------------- /examples/bolt_json/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - mecha.contrib.json_files 3 | - bolt 4 | data_pack: 5 | load: "src" 6 | pipeline: 7 | - mecha 8 | -------------------------------------------------------------------------------- /examples/bolt_json/src/data/minecraft/tags/functions/load.json: -------------------------------------------------------------------------------- 1 | name = demo:foo 2 | 3 | { 4 | "values": [name] 5 | } 6 | 7 | function name: 8 | say hello 9 | -------------------------------------------------------------------------------- /examples/bolt_lazy/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | meta: 8 | bolt: 9 | entrypoint: 10 | - "*" 11 | - "!*.lazy" 12 | -------------------------------------------------------------------------------- /examples/bolt_lazy/src/data/demo/modules/foo.bolt: -------------------------------------------------------------------------------- 1 | import ./hello1.lazy as _ 2 | -------------------------------------------------------------------------------- /examples/bolt_lazy/src/data/demo/modules/hello1.lazy.bolt: -------------------------------------------------------------------------------- 1 | function ./hello1: 2 | say hello1 3 | -------------------------------------------------------------------------------- /examples/bolt_lazy/src/data/demo/modules/hello2.lazy.bolt: -------------------------------------------------------------------------------- 1 | function ./hello2: 2 | say hello2 3 | -------------------------------------------------------------------------------- /examples/bolt_lectern_prelude/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | pipeline: 4 | - lectern 5 | - mecha 6 | meta: 7 | lectern: 8 | load: "source.txt" 9 | bolt: 10 | prelude: "demo:prelude" 11 | -------------------------------------------------------------------------------- /examples/bolt_lectern_prelude/source.txt: -------------------------------------------------------------------------------- 1 | @module demo:prelude 2 | stuff = 123 3 | 4 | @function demo:foo 5 | say stuff 6 | 7 | @overlay dummy 8 | @module demo:prelude 9 | stuff = 456 10 | 11 | @function demo:foo 12 | say stuff 13 | -------------------------------------------------------------------------------- /examples/bolt_loop/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_loop/src/data/demo/functions/init.mcfunction: -------------------------------------------------------------------------------- 1 | append function_tag minecraft:load { 2 | "values": [__name__] 3 | } 4 | 5 | scoreboard objectives add global dummy 6 | -------------------------------------------------------------------------------- /examples/bolt_macro/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_macro/src/data/demo/functions/bar.mcfunction: -------------------------------------------------------------------------------- 1 | from ./foo import foo, setblock, do_twice, >>, execute, tellraw, ! 2 | 3 | foo 4 | foo 4 5 | foo 3 double 6 | foo 3 hello @a[ 7 | scores = { 8 | x = 42 9 | } 10 | ] 11 | 12 | setblock 13 | setblock stone 14 | setblock 1 2 3 15 | setblock 1 2 3 stone 16 | 17 | do_twice: 18 | say this is repeated twice 19 | 20 | >> Custom symbols work 21 | as @a run >> Even inside execute 22 | as @a >> Overload execute to allow implicit "run" 23 | 24 | tellraw @s from ./dummy_message 25 | 26 | ! @e ! 27 | 28 | from ./foo import abc 29 | abc 42 30 | -------------------------------------------------------------------------------- /examples/bolt_macro_perf/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_macro_perf/src/data/demo/functions/export.mcfunction: -------------------------------------------------------------------------------- 1 | # Importing macros doesn't cause a command tree update when there is no code below 2 | 3 | from ./lib import foo1, foo2 4 | from ./lib import foo3 5 | -------------------------------------------------------------------------------- /examples/bolt_macro_perf/src/data/demo/functions/func1.mcfunction: -------------------------------------------------------------------------------- 1 | # Importing multiple macros in a row will update the command tree in a single batch 2 | 3 | from ./lib import foo1, foo2 4 | from ./lib import foo3 5 | 6 | foo1 7 | foo2 8 | foo3 9 | -------------------------------------------------------------------------------- /examples/bolt_macro_perf/src/data/demo/functions/func2.mcfunction: -------------------------------------------------------------------------------- 1 | # If multiple scopes end up using the same set of macros they will share the same underlying command spec 2 | 3 | from ./export import foo1, foo2, foo3 4 | 5 | foo1 6 | foo2 7 | foo3 8 | -------------------------------------------------------------------------------- /examples/bolt_macro_perf/src/data/demo/functions/lib.mcfunction: -------------------------------------------------------------------------------- 1 | # Defining multiple macros in a row will update the command tree in a single batch 2 | 3 | macro foo1: 4 | say foo1 5 | 6 | macro foo2: 7 | say foo2 8 | 9 | macro foo3: 10 | say foo3 11 | 12 | macro foo4: 13 | say foo4 14 | -------------------------------------------------------------------------------- /examples/bolt_memo/beet.yml: -------------------------------------------------------------------------------- 1 | pipeline: 2 | - require: 3 | - bolt 4 | data_pack: 5 | load: "src" 6 | pipeline: 7 | - mecha 8 | - beet.contrib.rename_files 9 | - beet.contrib.find_replace 10 | meta: 11 | rename_files: 12 | data_pack: 13 | match: "demo:*" 14 | find: "demo:([a-z_/]+)" 15 | replace: 'demo:ref/\1' 16 | find_replace: 17 | data_pack: 18 | match: "demo:*" 19 | substitute: 20 | find: "demo:([a-z_/]+)" 21 | replace: 'demo:ref/\1' 22 | - require: 23 | - bolt 24 | data_pack: 25 | load: "src" 26 | pipeline: 27 | - mecha 28 | -------------------------------------------------------------------------------- /examples/bolt_memo/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | memo: 2 | pass 3 | 4 | bop = 123 5 | memo bop, foo=bop, foo: 6 | thing = foo 7 | function ./ayy: 8 | say thing 9 | say foo 10 | 11 | a = (1, 2) 12 | a = (a, a) 13 | a = (a, a) 14 | 15 | memo a, a: 16 | say a 17 | 18 | say wat 19 | 20 | a = 1 21 | b = 2 22 | memo a, b: 23 | say (a + b) 24 | memo b: 25 | say b 26 | -------------------------------------------------------------------------------- /examples/bolt_memo/src/data/demo/functions/vars.mcfunction: -------------------------------------------------------------------------------- 1 | g_uwu = 1 2 | memo: 3 | g_uwu = 5 4 | say g_uwu 5 | 6 | def ok(): 7 | memo: 8 | value = 10 9 | global g_uwu 10 | g_uwu = value 11 | 12 | ok() 13 | say g_uwu 14 | 15 | def fib(n): 16 | if n <= 1: 17 | return n 18 | memo n: 19 | result = fib(n - 1) + fib(n - 2) 20 | return result 21 | 22 | for i in range(50): 23 | say f"fib({i}) = {fib(i)}" 24 | -------------------------------------------------------------------------------- /examples/bolt_memo2/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_memo2/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | say ok 2 | memo: 3 | append function __name__: 4 | say wat 5 | -------------------------------------------------------------------------------- /examples/bolt_memo3/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_memo3/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | n = 5 2 | execute function ~/{n}: 3 | say 1 4 | memo n: 5 | say 2 6 | append function ~/: 7 | say 3 8 | -------------------------------------------------------------------------------- /examples/bolt_memo4/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_memo4/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | def stuff(): 2 | memo: 3 | append function __name__: 4 | say something 5 | 6 | say before 7 | stuff() 8 | stuff() 9 | say after 10 | 11 | function ./bar: 12 | say bop 13 | stuff() 14 | -------------------------------------------------------------------------------- /examples/bolt_merge/beet.yml: -------------------------------------------------------------------------------- 1 | data_pack: 2 | load: ["pack_1", "pack_2"] 3 | require: 4 | - bolt 5 | - mecha.contrib.messages 6 | - beet.contrib.auto_yaml 7 | pipeline: 8 | - mecha 9 | -------------------------------------------------------------------------------- /examples/bolt_merge/pack_1/data/pack_1/functions/bob.mcfunction: -------------------------------------------------------------------------------- 1 | from pack_1:utils import hello 2 | hello("Bob") 3 | -------------------------------------------------------------------------------- /examples/bolt_merge/pack_1/data/pack_1/functions/utils.mcfunction: -------------------------------------------------------------------------------- 1 | def hello(name): 2 | say f"Hello, {name}!" 3 | hello("Alice") 4 | -------------------------------------------------------------------------------- /examples/bolt_merge/pack_2/data/pack_2/functions/carol.mcfunction: -------------------------------------------------------------------------------- 1 | from pack_1:utils import hello 2 | hello("Carol") 3 | -------------------------------------------------------------------------------- /examples/bolt_nested_location/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_nested_location/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | execute function ~/thing1: 2 | as @a function ~/thing2: 3 | function ~/thing{3:03}/hello 4 | say ~/thing{123456789:x}/hello 5 | 6 | schedule function ~/blob 2s append: 7 | say (~/, ~/../{~/[:3]}) 8 | 9 | function ./welp: 10 | if predicate ~/ say yes 11 | 12 | function ~/{"":_<2} 13 | function ~/foo{"bar":_^5} 14 | -------------------------------------------------------------------------------- /examples/bolt_nesting/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_nesting/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | from contextlib import contextmanager 2 | from bolt import Runtime 3 | 4 | runtime = ctx.inject(Runtime) 5 | say runtime.nesting 6 | 7 | @contextmanager 8 | def stuff(): 9 | if score foo temp matches 77: 10 | yield 11 | 12 | as @s say runtime.nesting 13 | 14 | name = ./thing 15 | 16 | with stuff(): 17 | function name: 18 | say runtime.nesting 19 | say runtime.nesting 20 | 21 | say runtime.nesting 22 | -------------------------------------------------------------------------------- /examples/bolt_order/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | meta: 8 | bolt: 9 | entrypoint: hello:entry_point 10 | -------------------------------------------------------------------------------- /examples/bolt_order/src/data/hello/modules/entry_point.bolt: -------------------------------------------------------------------------------- 1 | from hello:main import i_run_last 2 | 3 | i_run_last() 4 | -------------------------------------------------------------------------------- /examples/bolt_order/src/data/hello/modules/main.bolt: -------------------------------------------------------------------------------- 1 | def i_run_last(): 2 | print(2) 3 | append function hello:world: 4 | say second 5 | 6 | print(1) 7 | append function hello:world: 8 | say first 9 | -------------------------------------------------------------------------------- /examples/bolt_overgen/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt.contrib.sandbox 3 | - overgen.define_custom_resources 4 | - overgen.define_compilation_unit_providers 5 | - overgen.define_module_globals 6 | data_pack: 7 | load: "src" 8 | pipeline: 9 | - mecha 10 | - overgen.remove_custom_resources 11 | -------------------------------------------------------------------------------- /examples/bolt_overgen/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | value = "abc" 2 | print(value) 3 | say this should be left untouched 4 | -------------------------------------------------------------------------------- /examples/bolt_overgen/src/data/demo/overgen/stuff.bolt: -------------------------------------------------------------------------------- 1 | declare_overlay_formats( 2 | min_inclusive=18, 3 | max_inclusive=19, 4 | ) 5 | 6 | function ./foo: 7 | say stuff 8 | -------------------------------------------------------------------------------- /examples/bolt_overlay/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_overlay/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | from ./vars import stuff 2 | say f"my {stuff}" 3 | -------------------------------------------------------------------------------- /examples/bolt_overlay/src/data/demo/modules/vars.bolt: -------------------------------------------------------------------------------- 1 | stuff = 123 2 | -------------------------------------------------------------------------------- /examples/bolt_overlay/src/dummy_overlay/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | from ./vars import stuff 2 | say (1 + 2) 3 | say stuff 4 | -------------------------------------------------------------------------------- /examples/bolt_patchers/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt.contrib.sandbox 3 | - patchers.define_custom_resources 4 | data_pack: 5 | load: "src" 6 | pipeline: 7 | - patchers.process_files 8 | -------------------------------------------------------------------------------- /examples/bolt_patchers/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | say this is not compiled 2 | 3 | value = 123 4 | print(value) 5 | 6 | # As long as you don't mc.compile(ctx.data) or include "mecha" in the pipeline 7 | # you can leverage mecha's compiler and the bolt runtime for other purposes 8 | # without affecting function files in the output pack. 9 | -------------------------------------------------------------------------------- /examples/bolt_patchers/src/data/demo/patchers/arrow_recipes.bolt: -------------------------------------------------------------------------------- 1 | targets = { 2 | recipes: "minecraft:*arrow" 3 | } 4 | 5 | def patch(name, recipe): 6 | if recipe.type == minecraft:crafting_shaped: 7 | result = recipe.result 8 | 9 | recipe.key."#" = { 10 | tag: minecraft:coals 11 | } 12 | 13 | if result.item == minecraft:arrow: 14 | del recipe.key["X"] 15 | recipe.pattern[0] = "#" 16 | 17 | result["count"] += 2 + (10 - 9) * 3 18 | -------------------------------------------------------------------------------- /examples/bolt_patchers/src/data/minecraft/recipes/arrow.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:crafting_shaped", 3 | "category": "equipment", 4 | "key": { 5 | "#": { 6 | "item": "minecraft:stick" 7 | }, 8 | "X": { 9 | "item": "minecraft:flint" 10 | }, 11 | "Y": { 12 | "item": "minecraft:feather" 13 | } 14 | }, 15 | "pattern": ["X", "#", "Y"], 16 | "result": { 17 | "count": 4, 18 | "item": "minecraft:arrow" 19 | }, 20 | "show_notification": true 21 | } 22 | -------------------------------------------------------------------------------- /examples/bolt_patchers/src/data/minecraft/recipes/spectral_arrow.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:crafting_shaped", 3 | "category": "equipment", 4 | "key": { 5 | "#": { 6 | "item": "minecraft:glowstone_dust" 7 | }, 8 | "X": { 9 | "item": "minecraft:arrow" 10 | } 11 | }, 12 | "pattern": [" # ", "#X#", " # "], 13 | "result": { 14 | "count": 2, 15 | "item": "minecraft:spectral_arrow" 16 | }, 17 | "show_notification": true 18 | } 19 | -------------------------------------------------------------------------------- /examples/bolt_patchers/src/data/minecraft/recipes/tipped_arrow.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "minecraft:crafting_special_tippedarrow", 3 | "category": "misc" 4 | } 5 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/demo/functions/bar.mcfunction: -------------------------------------------------------------------------------- 1 | dump_ast() 2 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | !!! 2 | greet anonymous() 3 | summon CALAMAR 4 | CALAMAR = None 5 | 6 | !!! 7 | alright_then() 8 | what about minecraft:becomeduck 9 | 10 | !!! 11 | dump_ast() 12 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/demo/modules/macros.bolt: -------------------------------------------------------------------------------- 1 | macro greet name=brigadier:string{"type": "word"}: 2 | say f"hello {name.value}" 3 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/demo/modules/other.bolt: -------------------------------------------------------------------------------- 1 | from bolt import Runtime 2 | 3 | CALAMAR = minecraft:squid 4 | 5 | def dump_ast(): 6 | runtime = ctx.inject(Runtime) 7 | function generate_path(): 8 | for line in runtime.modules.current.ast.dump().splitlines(): 9 | raw f"# {line}" 10 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/demo/modules/prelude.bolt: -------------------------------------------------------------------------------- 1 | from ./macros import greet 2 | from ./other import CALAMAR, dump_ast 3 | 4 | macro !!!: 5 | say !!! 6 | 7 | def anonymous() -> str: 8 | return "anonymous" 9 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/no_idea/modules/aaa.bolt: -------------------------------------------------------------------------------- 1 | from ./bbb import okok 2 | from demo:macros import greet 3 | 4 | def alright_then(): 5 | okok() 6 | greet steve 7 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/no_idea/modules/bbb.bolt: -------------------------------------------------------------------------------- 1 | def okok(): 2 | say ok ok 3 | -------------------------------------------------------------------------------- /examples/bolt_prelude/src/data/no_idea/modules/prelude.bolt: -------------------------------------------------------------------------------- 1 | from ./aaa import alright_then 2 | 3 | macro what about(stream): 4 | from mecha import delegate 5 | node = delegate("resource_location", stream) 6 | say repr(node) 7 | -------------------------------------------------------------------------------- /examples/bolt_proc_macro/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - bolt 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - mecha 7 | -------------------------------------------------------------------------------- /examples/bolt_proc_macro/src/data/demo/functions/foo.mcfunction: -------------------------------------------------------------------------------- 1 | from ./util import repeat, lisp 2 | 3 | value = 3 4 | 5 | repeat 7: 6 | value += 1 7 | 8 | repeat 3: 9 | say value 10 | 11 | as @a run repeat 3: 12 | say value 13 | 14 | repeat until value < 5: 15 | say value 16 | value -= 1 17 | 18 | repeat until @a[scores={counter=10}]: 19 | scoreboard players add @r counter 1 20 | 21 | lisp foo 22 | lisp 123 23 | lisp (foo 123) 24 | lisp (foo 123 () (bar)) 25 | lisp ( 26 | (defun do_math (x y) 27 | (add x y)) 28 | (defun do_more_math (x y) 29 | (mul (do_math x y) y)) 30 | ) 31 | -------------------------------------------------------------------------------- /examples/bolt_sample_ui/beet.yml: -------------------------------------------------------------------------------- 1 | require: 2 | - sample_ui.resources 3 | data_pack: 4 | load: "src" 5 | pipeline: 6 | - sample_ui.generate 7 | -------------------------------------------------------------------------------- /examples/bolt_sample_ui/sample_ui/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mcbeet/bolt/cf98369e2f62e21e1e95d5f071d71e5b894b5612/examples/bolt_sample_ui/sample_ui/__init__.py -------------------------------------------------------------------------------- /examples/bolt_sample_ui/sample_ui/generate.py: -------------------------------------------------------------------------------- 1 | from beet import Context, subproject 2 | 3 | from .resources import UiScreen 4 | 5 | 6 | def beet_default(ctx: Context): 7 | all_screens = { 8 | name: screen_file.text for name, screen_file in ctx.data[UiScreen].items() 9 | } 10 | ctx.data[UiScreen].clear() 11 | 12 | ctx.require( 13 | subproject( 14 | { 15 | "require": ["bolt"], 16 | "data_pack": {"load": {"data/sample_ui/modules": "@sample_ui/modules"}}, 17 | "pipeline": ["mecha"], 18 | "meta": { 19 | "bolt": {"entrypoint": "sample_ui:main"}, 20 | "sample_ui": {"all_screens": all_screens}, 21 | }, 22 | } 23 | ) 24 | ) 25 | -------------------------------------------------------------------------------- /examples/bolt_sample_ui/sample_ui/modules/main.bolt: -------------------------------------------------------------------------------- 1 | import xml.etree.ElementTree as ET 2 | 3 | for name, content in ctx.meta.sample_ui.all_screens.items(): 4 | parser = ET.XMLPullParser(["start", "end"]) 5 | parser.feed(content) 6 | 7 | function name: 8 | for event, elem in parser.read_events(): 9 | say (event, elem.tag, elem.attrib) 10 | -------------------------------------------------------------------------------- /examples/bolt_sample_ui/sample_ui/resources.py: -------------------------------------------------------------------------------- 1 | from typing import ClassVar 2 | 3 | from beet import Context, NamespaceFileScope, TextFileBase 4 | 5 | 6 | class UiScreen(TextFileBase[str]): 7 | scope: ClassVar[NamespaceFileScope] = ("ui_screens",) 8 | extension: ClassVar[str] = ".xml" 9 | 10 | 11 | def beet_default(ctx: Context): 12 | ctx.data.extend_namespace.append(UiScreen) 13 | -------------------------------------------------------------------------------- /examples/bolt_sample_ui/src/data/demo/ui_screens/foo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |