RuleEdit: A .rule file editing tool

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
I6_I6
Posts: 1175
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

RuleEdit: A .rule file editing tool

Post by I6_I6 »

I started working on an .rule file editor a long time ago, but I didn't have enough time to make good progress so it's been sitting in my files in an early development stage for quite a while. I knew I wouldn't be able finish the project without other people's help, so I decided to post about it here.

GitHub repo: https://github.com/I6-I6/RuleEdit

To try it yourself, run it locally using Vite:

Code: Select all

git clone https://github.com/I6-I6/RuleEdit.git
cd RuleEdit
npm install
npm run dev
Here's a brief explanation on how RuleEdit works so you don't have to figure it out yourself:
It was built using CodeMirror 6 and written in JavaScript.
Whenever the user alters something in the text field, the text is sent to analyzer.js, which then scans through the text section by section. It returns an object containing an array of diagnostics (i.e. issues), an array of tokens (info on how to style the text) and the rule name. renderer.js takes this and applies everything.

Current features

Underline diagnostics:
  • Errors: Guaranteed crash; solid red underline
  • Warnings: Potential crash; solid orange underline
  • Hints: Not a crash, but helpful information (such as omitting duplicates); dotted green underline
Syntax styling:
  • Section headers: light blue
  • Comments: italicized gray
  • Keywords: pinkish red
  • Numbers: tan
  • Variables: orange
As I mentioned earlier, this is very incomplete. I haven't even finished the diagnostics framework. So far it's only capable of analyzing the @RULE section, nothing else.

Things to add
  • Finish logic for the rest of analyze.js
  • Display diagnostic messages at the bottom (diagnostics-panel element). Click on them to jump to the line. Add buttons to ignore/quick fixes.
  • Autocorrect/autocomplete/suggestions popups
  • Import/export .rule files
  • Table-to-tree & tree-to-table shortcuts
  • Rulestring-to-table/tree shortcuts
  • Color picker for @COLORS and @ICONS
  • Drawing & import images features for @ICONS
  • Rule preview (maybe) (using LV?)
Help would be much appreciated! Please don't hesitate to ask questions or give suggestions.

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
I6_I6
Posts: 1175
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: RuleEdit: A .rule file editing tool

Post by I6_I6 »

I've just looked at RuletableGolfer and got a new idea. What if we implemented something similar to that so that users could switch between a button selection-based editor and a text-based editor?

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
NNlk05
Posts: 850
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: RuleEdit: A .rule file editing tool

Post by NNlk05 »

I had an idea like this, seeing that you had a base, may I PR this?
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
The world is my country, science my religion.
User avatar
I6_I6
Posts: 1175
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: RuleEdit: A .rule file editing tool

Post by I6_I6 »

NNlk05 wrote: July 3rd, 2026, 2:08 am I had an idea like this, seeing that you had a base, may I PR this?
What does PR mean?

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
NNlk05
Posts: 850
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: RuleEdit: A .rule file editing tool

Post by NNlk05 »

I6_I6 wrote: July 3rd, 2026, 2:13 am What does PR mean?
Pull request, aka contribute.
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
The world is my country, science my religion.
User avatar
I6_I6
Posts: 1175
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: RuleEdit: A .rule file editing tool

Post by I6_I6 »

NNlk05 wrote: July 3rd, 2026, 2:16 am
I6_I6 wrote: July 3rd, 2026, 2:13 am What does PR mean?
Pull request, aka contribute.
Sure! What do you want to add?

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
NNlk05
Posts: 850
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: RuleEdit: A .rule file editing tool

Post by NNlk05 »

I6_I6 wrote: July 3rd, 2026, 2:17 am Sure! What do you want to add?
Let’s see.
I can do the color picker, import and export, and maybe autocomplete.
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
The world is my country, science my religion.
User avatar
NNlk05
Posts: 850
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: RuleEdit: A .rule file editing tool

Post by NNlk05 »

I6_I6 wrote: July 3rd, 2026, 2:17 am Sure! What do you want to add?
Let’s see.
I can do the color picker, import and export, and maybe autocomplete.
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
The world is my country, science my religion.
User avatar
I6_I6
Posts: 1175
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: RuleEdit: A .rule file editing tool

Post by I6_I6 »

NNlk05 wrote: July 3rd, 2026, 2:23 am
I6_I6 wrote: July 3rd, 2026, 2:17 am Sure! What do you want to add?
Let’s see.
I can do the color picker, import and export, and maybe autocomplete.
I don't think we're ready for those features just yet, but you could add them later. For now, I'll do the diagnostics panel and then finish the analysis logic.

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
User avatar
NNlk05
Posts: 850
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: RuleEdit: A .rule file editing tool

Post by NNlk05 »

Code: Select all

Uncaught TypeError: Failed to resolve module specifier "codemirror". Relative references must start with either "/", "./", or "../".
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
The world is my country, science my religion.
User avatar
I6_I6
Posts: 1175
Joined: July 26th, 2025, 8:44 pm
Location: Here, there, somewhere, anywhere, everywhere.
Contact:

Re: RuleEdit: A .rule file editing tool

Post by I6_I6 »

NNlk05 wrote: July 3rd, 2026, 6:20 am

Code: Select all

Uncaught TypeError: Failed to resolve module specifier "codemirror". Relative references must start with either "/", "./", or "../".
Looks like it isn't importing CodeMirror correctly. It happens when you open index.html directly in the browser; you should install Vite and run it using Vite instead. (See the first post)

Code: Select all

#C [[ THEME Golly ]]
x = 27, y = 15, rule = LifeHistory
8.A$A6.A.A$3A4.BA2B.B2D$3.A4.2B.2B2DB$2.2A2.3B.6B2.3B$2.20B$4.19B$4.2B
C10BD4B$4.2B2C10BD4B$4.B2C11B2D3B$4.13B2D4B$5.12BD3B.B2A$6.13B3.BA.A$
6.3B.B3.B10.A$25.2A!
RuleEdit: A .rule file editing tool
Post Reply