Has anyone else been looking into this stuff in the meantime or is it just me who's insane? Any ideas?
Syntax for describing 2.0 - style combinators?
-
charredUtensil
- Burner Inserter

- Posts: 11
- Joined: Sat Jun 10, 2017 6:38 am
- Contact:
Syntax for describing 2.0 - style combinators?
Hey folks - A few years decade ago I built a project to help me figure out how circuit networks work and how to build them. In the process, I ended up coming up with a notation to describe circuit networks as a sort of "code". I left that project to rot when changes in Factorio and a few mods started to make circuit development more comprehensible in-game. I'm poking around for some new side project to do outside of work and it occurred to me that after the changes to networks in 2.0 and 2.1, combinators have become somewhat incomprehensible again and it feels like a natural space to return to. The original CNIDE syntax can't begin to describe the new logic. Meanwhile, libraries for manipulating Factorio blueprints have gotten better and I have quite a bit more experience now as well, so I could imagine a project that can "compile" a combinator system to a blueprint - and even decompile it by storing some data like variable names in the comments.
Has anyone else been looking into this stuff in the meantime or is it just me who's insane? Any ideas?
Has anyone else been looking into this stuff in the meantime or is it just me who's insane? Any ideas?
-
charredUtensil
- Burner Inserter

- Posts: 11
- Joined: Sat Jun 10, 2017 6:38 am
- Contact:
Re: Syntax for describing 2.0 - style combinators?
I've been thinking about this a bit more. The CNIDE syntax is close enough with some modifications:
- Signals can be referred to with dot notation within most definitions as .
Code: Select all
WIRE_NAME.signal_name- This can create invalid combinations when more than two wires are specified.
- This also means the input/output wire sections can be omitted if there are no ambiguous signals.
- For situations where an output signal is taken from and/or sent to only the red or green wire, I have a few ideas:
- INPUT_WIRE.signal_name as OUTPUT_WIRE.signal_name, where the signal name must be the same in both cases.
- Flip the conditions unambiguously, since the syntax was already confusing.
Code: Select all
1 asbecomesCode: Select all
1 as signal_name. Then use the intuitive syntaxCode: Select all
signal_name = 1. Again, the signal name must be the same in both cases. This itself is awkward because the idea of a combinator output doesn't quite map to how any other language uses equals.Code: Select all
OUTPUT_WIRE.signal_name = INPUT_WIRE.signal_name - A special syntax like .
Code: Select all
signal_name from INPUT_WIRE - This might make the "normal" syntax weird.
- The syntax can be replaced with some other constant instead of 1 now.
Code: Select all
1 as signal_name - Conditions can be specified with and
Code: Select all
and.Code: Select all
or - A decider combinator has multiple outputs. Haven't decided if they should be comma-separated yet
- Add `else` keyword which works as expected.