Skip to content

Commit 5da8e07

Browse files
committed
feat: Quale language support for VS Code
Syntax highlighting, snippets, and language configuration for .quale files. Includes three-tier comment system (--, --!, --!!).
0 parents  commit 5da8e07

8 files changed

Lines changed: 520 additions & 0 deletions

File tree

.vscodeignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git/**
2+
.gitignore

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Provant
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Quale Language Support for VS Code
2+
3+
Syntax highlighting and code snippets for the [Quale](https://quale.dev) neuroevolution language.
4+
5+
Quale is a domain-specific language for evolving neural networks using NEAT (NeuroEvolution of Augmenting Topologies). Define agent bodies, worlds, fitness criteria, and evolution parameters in `.quale` files, then let the engine evolve brains that solve your problem.
6+
7+
## Features
8+
9+
- Syntax highlighting for all `.quale` constructs
10+
- Three-tier comment system (`--`, `--!`, `--!!`)
11+
- Code snippets for rapid scaffolding
12+
- Auto-closing brackets and string pairs
13+
- Code folding on brace blocks
14+
- Auto-indentation
15+
16+
## Comment System
17+
18+
Quale uses a semantic comment system:
19+
20+
```quale
21+
-- Regular comment (discarded by parser)
22+
--! NOTE: this needs calibration (note - preserved in AST)
23+
--!! FIXME: hardcoded value (critical - blocks --strict mode)
24+
```
25+
26+
| Syntax | Purpose | Visibility |
27+
|--------|---------|------------|
28+
| `--` | Author notes, scratchpad | Parser discards |
29+
| `--!` | Notes, TODOs | Shown in `quale check` |
30+
| `--!!` | Critical issues | Fails `quale check --strict` |
31+
32+
## Snippets
33+
34+
| Prefix | Description |
35+
|--------|-------------|
36+
| `body` | Agent body with sensors and actuators |
37+
| `sensor-internal` | Internal state sensor |
38+
| `sensor-directional` | Directional sensor (4 nodes) |
39+
| `sensor-property` | Item property sensor |
40+
| `sensor-social` | Social/peer sensor |
41+
| `actuator-directional` | Directional actuator (4 nodes) |
42+
| `actuator-trigger` | Trigger actuator |
43+
| `item` | Item with properties and effects |
44+
| `world` | World grid configuration |
45+
| `fitness` | Fitness objectives |
46+
| `evolve` | Evolution experiment |
47+
| `evolve-full` | Evolution with all optional blocks |
48+
| `mutation` | Mutation rate block |
49+
| `speciation` | Speciation block |
50+
| `convergence` | Convergence block |
51+
| `checkpoint` | Checkpoint block |
52+
53+
## Installation
54+
55+
Search for "Quale" in the VS Code Extensions panel, or install from the command line:
56+
57+
```bash
58+
code --install-extension Provant.quale-lang
59+
```
60+
61+
## Links
62+
63+
- [Quale Documentation](https://quale.dev/docs/)
64+
- [Quale Engine](https://github.com/Provant15/quale)
65+
- [Report Issues](https://github.com/Provant15/quale-vscode/issues)

icon.png

61.1 KB
Loading

language-configuration.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"comments": {
3+
"lineComment": "--"
4+
},
5+
"brackets": [
6+
["{", "}"],
7+
["(", ")"],
8+
["[", "]"]
9+
],
10+
"autoClosingPairs": [
11+
{ "open": "{", "close": "}" },
12+
{ "open": "(", "close": ")" },
13+
{ "open": "[", "close": "]" },
14+
{ "open": "\"", "close": "\"" },
15+
{ "open": "/*", "close": " */" }
16+
],
17+
"surroundingPairs": [
18+
{ "open": "{", "close": "}" },
19+
{ "open": "(", "close": ")" },
20+
{ "open": "[", "close": "]" },
21+
{ "open": "\"", "close": "\"" }
22+
],
23+
"indentationRules": {
24+
"increaseIndentPattern": "\\{\\s*$",
25+
"decreaseIndentPattern": "^\\s*\\}"
26+
},
27+
"folding": {
28+
"markers": {
29+
"start": "\\{",
30+
"end": "\\}"
31+
}
32+
}
33+
}

package.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "quale-lang",
3+
"displayName": "Quale",
4+
"description": "Syntax highlighting and snippets for the Quale neuroevolution language",
5+
"version": "0.2.0",
6+
"publisher": "Provant",
7+
"license": "MIT",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/Provant15/quale-vscode"
11+
},
12+
"homepage": "https://quale.dev",
13+
"bugs": {
14+
"url": "https://github.com/Provant15/quale-vscode/issues"
15+
},
16+
"engines": {
17+
"vscode": "^1.80.0"
18+
},
19+
"categories": [
20+
"Programming Languages",
21+
"Snippets"
22+
],
23+
"keywords": [
24+
"quale",
25+
"neuroevolution",
26+
"NEAT",
27+
"DSL",
28+
"evolution"
29+
],
30+
"icon": "icon.png",
31+
"contributes": {
32+
"languages": [
33+
{
34+
"id": "quale",
35+
"aliases": ["Quale", "quale"],
36+
"extensions": [".quale"],
37+
"configuration": "./language-configuration.json"
38+
}
39+
],
40+
"grammars": [
41+
{
42+
"language": "quale",
43+
"scopeName": "source.quale",
44+
"path": "./syntaxes/quale.tmLanguage.json"
45+
}
46+
],
47+
"snippets": [
48+
{
49+
"language": "quale",
50+
"path": "./snippets/quale.json"
51+
}
52+
]
53+
}
54+
}

snippets/quale.json

Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
{
2+
"Body": {
3+
"prefix": "body",
4+
"body": [
5+
"body ${1:Name} {",
6+
" sensor ${2:name}: internal(0..1)",
7+
" sensor ${3:nearby}: directional(range: ${4:20}, directions: 4)",
8+
"",
9+
" actuator ${5:move}: directional(threshold: 0.5, directions: 4)",
10+
" actuator ${6:act}: trigger(threshold: 0.5)",
11+
"}"
12+
],
13+
"description": "Define an agent body with sensors and actuators"
14+
},
15+
"Sensor Internal": {
16+
"prefix": "sensor-internal",
17+
"body": [
18+
"sensor ${1:name}: internal(0..1)"
19+
],
20+
"description": "Internal state sensor (one brain input node)"
21+
},
22+
"Sensor Directional": {
23+
"prefix": "sensor-directional",
24+
"body": [
25+
"sensor ${1:name}: directional(range: ${2:20}, directions: 4)"
26+
],
27+
"description": "Directional sensor (4 brain input nodes: N/S/E/W)"
28+
},
29+
"Sensor Item Property": {
30+
"prefix": "sensor-property",
31+
"body": [
32+
"sensor ${1:name}: item_property(${2:field})"
33+
],
34+
"description": "Item property sensor (nearest item's observable property)"
35+
},
36+
"Sensor Social": {
37+
"prefix": "sensor-social",
38+
"body": [
39+
"sensor ${1:peer_health}: social(${2:health})"
40+
],
41+
"description": "Social sensor (peer agent's visible state, requires agents: 2)"
42+
},
43+
"Actuator Directional": {
44+
"prefix": "actuator-directional",
45+
"body": [
46+
"actuator ${1:move}: directional(threshold: ${2:0.5}, directions: 4)"
47+
],
48+
"description": "Directional actuator (4 brain output nodes, winner-take-all)"
49+
},
50+
"Actuator Trigger": {
51+
"prefix": "actuator-trigger",
52+
"body": [
53+
"actuator ${1:act}: trigger(threshold: ${2:0.5})"
54+
],
55+
"description": "Trigger actuator (fires when activation exceeds threshold)"
56+
},
57+
"Item": {
58+
"prefix": "item",
59+
"body": [
60+
"item ${1:Name} {",
61+
" category: ${2:resource}",
62+
" properties {",
63+
" ${3:color}: ${4:0.5}",
64+
" }",
65+
" on_consume {",
66+
" ${5:energy}: ${6:+0.3}",
67+
" }",
68+
"}"
69+
],
70+
"description": "Define an item with observable properties and hidden effects"
71+
},
72+
"World": {
73+
"prefix": "world",
74+
"body": [
75+
"world ${1:Name} {",
76+
" size: ${2:10} x ${3:10}",
77+
" walls: border",
78+
" item_respawn: ${4:30} ticks",
79+
" spawn ${5:resource}: ${6:4}",
80+
"}"
81+
],
82+
"description": "Define a world grid with item spawning"
83+
},
84+
"Fitness": {
85+
"prefix": "fitness",
86+
"body": [
87+
"fitness ${1:Name} {",
88+
" maximize survival: ${2:10.0}",
89+
" maximize ${3:health}: ${4:5.0}",
90+
" reward ${5:collected}: ${6:2.0}",
91+
" penalize ${7:idle}: ${8:1.0}",
92+
" penalize complexity: 0.001",
93+
"}"
94+
],
95+
"description": "Define fitness objectives (what success looks like)"
96+
},
97+
"Evolve": {
98+
"prefix": "evolve",
99+
"body": [
100+
"evolve ${1:Name} {",
101+
" body: ${2:AgentBody}",
102+
" items: [${3:Item1, Item2}]",
103+
" world: ${4:WorldName}",
104+
" fitness: ${5:FitnessName}",
105+
"",
106+
" population: ${6:200}",
107+
" generations: ${7:1000}",
108+
" scenarios: ${8:5}",
109+
" ticks: ${9:300}",
110+
" seed: ${10:42}",
111+
" agents: ${11:1}",
112+
"}"
113+
],
114+
"description": "Define an evolution experiment"
115+
},
116+
"Evolve with Mutation": {
117+
"prefix": "evolve-full",
118+
"body": [
119+
"evolve ${1:Name} {",
120+
" body: ${2:AgentBody}",
121+
" items: [${3:Item1, Item2}]",
122+
" world: ${4:WorldName}",
123+
" fitness: ${5:FitnessName}",
124+
"",
125+
" population: ${6:200}",
126+
" generations: ${7:1000}",
127+
" scenarios: ${8:5}",
128+
" ticks: ${9:300}",
129+
" seed: ${10:42}",
130+
" agents: ${11:1}",
131+
"",
132+
" mutation {",
133+
" weight_shift: 0.8",
134+
" bias_shift: 0.1",
135+
" add_connection: 0.05",
136+
" remove_connection: 0.03",
137+
" add_node: 0.03",
138+
" remove_node: 0.01",
139+
" rewire: 0.02",
140+
" change_activation: 0.01",
141+
" }",
142+
"",
143+
" speciation {",
144+
" threshold: 3.0",
145+
" target_species: 15",
146+
" stagnation: 15 generations",
147+
" }",
148+
"",
149+
" convergence {",
150+
" plateau: 200 generations",
151+
" threshold: 0.5",
152+
" }",
153+
"",
154+
" checkpoint {",
155+
" every: 100 generations",
156+
" keep: 3",
157+
" }",
158+
"}"
159+
],
160+
"description": "Define an evolution experiment with all optional blocks"
161+
},
162+
"Mutation Block": {
163+
"prefix": "mutation",
164+
"body": [
165+
"mutation {",
166+
" weight_shift: ${1:0.8}",
167+
" bias_shift: ${2:0.1}",
168+
" add_connection: ${3:0.05}",
169+
" remove_connection: ${4:0.03}",
170+
" add_node: ${5:0.03}",
171+
" remove_node: ${6:0.01}",
172+
" rewire: ${7:0.02}",
173+
" change_activation: ${8:0.01}",
174+
"}"
175+
],
176+
"description": "Mutation rate configuration block"
177+
},
178+
"Speciation Block": {
179+
"prefix": "speciation",
180+
"body": [
181+
"speciation {",
182+
" threshold: ${1:3.0}",
183+
" target_species: ${2:15}",
184+
" stagnation: ${3:15} generations",
185+
"}"
186+
],
187+
"description": "Speciation configuration block"
188+
},
189+
"Convergence Block": {
190+
"prefix": "convergence",
191+
"body": [
192+
"convergence {",
193+
" plateau: ${1:200} generations",
194+
" threshold: ${2:0.5}",
195+
"}"
196+
],
197+
"description": "Convergence detection block"
198+
},
199+
"Checkpoint Block": {
200+
"prefix": "checkpoint",
201+
"body": [
202+
"checkpoint {",
203+
" every: ${1:100} generations",
204+
" keep: ${2:3}",
205+
"}"
206+
],
207+
"description": "Checkpoint save configuration"
208+
}
209+
}

0 commit comments

Comments
 (0)