You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/plain_language_specification.md
+65-71Lines changed: 65 additions & 71 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,21 @@
1
1
# Overview
2
2
3
-
## About Plain programming language
3
+
## About ***plain programming language
4
4
5
-
Plain is a novel programming language that helps abstracting away complexity of using large language models for code generation.
5
+
***plain is a novel programming language that helps abstracting away complexity of using large language models for code generation.
6
6
7
-
Plain specification is rendered to software code that can be executed. You can therefore think of Plain as *executable specification*.
7
+
***plain specification is rendered to software code that can be executed. You can therefore think of ***plain as *executable specification*.
8
8
9
9
## Syntax
10
10
11
-
Plain language is structured English based on markdown syntax.
11
+
***plain language is structured English based on markdown syntax.
12
12
13
-
Here's an example of a "hello,world" program in Plain.
13
+
Here's an example of a "hello,world" program in ***plain.
14
14
15
15
```plain
16
16
***Non-Functional Requirements:***
17
17
18
-
- Implementation should be in Python.
18
+
- :Implementation: should be in Python.
19
19
20
20
***Functional Requirements:***
21
21
@@ -26,7 +26,7 @@ Here's an example of a "hello,world" program in Plain.
26
26
27
27
## Source organization
28
28
29
-
Plain source can be organized in sections and subsection using markdown headers.
29
+
***plain source can be organized in sections and subsection using markdown headers.
30
30
31
31
```plain
32
32
# Section 1
@@ -35,15 +35,30 @@ Plain source can be organized in sections and subsection using markdown headers.
35
35
36
36
***Non-Functional Requirements:***
37
37
38
-
- Simple non-functional requirement
38
+
- First simple non-functional requirement
39
+
40
+
***Functional Requirements:***
41
+
42
+
- First simple functional requirement
39
43
40
44
## Section 2.1
41
45
46
+
***Non-Functional Requirements:***
47
+
48
+
- Second simple non-functional requirement
49
+
42
50
***Functional Requirements:***
43
51
44
-
- Simple functional requirement
52
+
- Second simple functional requirement
45
53
```
46
54
55
+
This enables hierarchical organization of the specification.
56
+
57
+
In example above:
58
+
59
+
- While rendering the "First simple functional requirement", the renderer will not have access to the "Second simple non-functional requirement".
60
+
- While rendering the "Second simple functional requirement", the renderer will not have access to the "First simple non-functional requirement".
61
+
47
62
### Specifications
48
63
49
64
There are four types of specifications:
@@ -59,26 +74,40 @@ Functional requirements must reside in leaf sections while other specifications
59
74
60
75
## Definitions
61
76
62
-
The `***Definitions:***` specification is a list of definitions of new terms.
77
+
The `***Definitions:***` specification is a list of definitions of new concepts.
63
78
64
79
Here's an example of a simple definiton.
65
80
66
81
```plain
67
-
- The App implements a task manager application.
82
+
- :App: implements a task manager application.
68
83
```
69
84
70
-
The definitions should follow **The Noun convention**. That is, the introduced terms should start with the word **The** (capitalized) followed by a capitalized word (e.g. **The App**).
85
+
In this case, the concept name is `:App:`. Concepts are important for refering to definitions in the rest of the specification.
86
+
87
+
While providing definitions, you should adhere to the following 4 rules:
71
88
72
-
Definitons are the mechanism for definining data structures in Plain. Here's an example of a such a definition.
89
+
- Every definition must start with the name of the concept you are defining.
90
+
- Every concept name starts and ends with colon (`:`) following by concept name in PascalCase. Examples: `:App:`, `:Tasks:`, `:ListOfUsers:`, `:CLI:`.
91
+
- Concept names must be globally unique (meaning, you cannot provide two definitions with the same concept name).
92
+
- When referencing concepts in ***Test Requirements:***, ***Functional Requirements:***, ***Non-Functional Requirements:*** and ***Acceptance Tests:***, the concept name must exist in the ***Definitions:*** section.
93
+
94
+
Furthermore, there are special concepts that are already defined and are ready to use. They should not be redefined:
95
+
96
+
-`:ConformanceTests:`
97
+
-`:UnitTests:`
98
+
-`:AcceptanceTests:`
99
+
-`:Implementation:`
100
+
101
+
Definitions are the mechanism for definining data structures in ***plain. Here's an example of two definitions.
73
102
74
103
```plain
75
-
- The Task describes an activity that needs to be done by The User. The Task has the following attributes
76
-
- Name - a short description of The Task. This is a required attribute. The name must be at least 3 characters long.
77
-
- Notes - additional details about The Task
78
-
- Due Date - optional date by which The User is supposed to complete The Task.
79
-
```
104
+
- :User: is a person who uses the application.
80
105
81
-
The definition of a term is provided in natural language. There are no restrictions on the form of the description. When referring to other terms **The Noun convention** should be followed.
106
+
- :Task: describes an activity that needs to be done by :User:. :Task: has the following attributes:
107
+
- Name - a short description of :Task:. This is a required attribute. The name must be at least 3 characters long.
108
+
- Notes - additional details about :Task:
109
+
- Due Date - optional date by which :User: is supposed to complete :Task:.
110
+
```
82
111
83
112
## Non-Functional Requirements
84
113
@@ -87,24 +116,24 @@ The `***Non-Functional Requirements:***` specification is a list of instructions
87
116
Here's an example of a simple instruction specifying only that the Plain specification should be rendered to Python software code.
88
117
89
118
```plain
90
-
- Implementation should be in Python.
119
+
- :Implementation: should be in Python.
91
120
```
92
121
93
-
The instructions should be provided in natural language. There are no restrictions on the form or the complexity of the instruction except that they need to be given as a markdown list. When referring to other terms **The Noun convention** should be followed.
122
+
The instructions should be provided in natural language. There are no restrictions on the form or the complexity of the instruction except that they need to be given as a markdown list.
94
123
95
124
Here's an example of more complex instructions.
96
125
97
126
```plain
98
-
- Implementation of The Program should be in Python (The Implementation).
127
+
- :Implementation: of :App: should be in Python.
99
128
100
-
- The Implementation should include unit tests using Unittest framework (The Unittests).
129
+
- :Implementation: should include unit tests using Unittest framework.
101
130
102
-
- The main executable file of The Program should be called hello_world.py
131
+
- The main executable file of :App: should be called hello_world.py
103
132
```
104
133
105
134
## Functional Requirements
106
135
107
-
The `***Functional Requirements:***` specification provides a description of functionality that should be rendered to software code. The descriptions should be provided in natural language as a markdown list. When referring to other terms **The Noun convention** should be followed.
136
+
The `***Functional Requirements:***` specification provides a description of functionality that should be rendered to software code. The descriptions should be provided in natural language as a markdown list.
108
137
109
138
Here's an example of a simple description of the functionality of the "hello, world" application.
110
139
@@ -115,7 +144,7 @@ Here's an example of a simple description of the functionality of the "hello, wo
115
144
Each functional requirement must be limited in complexity. For example, for the functional requirement
116
145
117
146
```plain
118
-
- Implement a task manager application.
147
+
- :App: should implement a task manager application.
119
148
```
120
149
121
150
the renderer of Plain source to software code should respond with
@@ -129,17 +158,17 @@ In such case you need to break down the functioanlity into smaller, less-complex
129
158
Here's an example how to do such a break down in the case of a task manager application.
130
159
131
160
```plain
132
-
- Implement the entry point for The App.
161
+
- Implement the entry point for :App:.
133
162
134
-
- Show The Task List.
163
+
- Show :Task: List.
135
164
136
-
- The User should be able to add The Task. Only valid The Task items can be added.
165
+
- :User: should be able to add :Task:. Only valid :Task: items can be added.
137
166
138
-
- The User should be able to delete The Task.
167
+
- :User: should be able to delete :Task:.
139
168
140
-
- The User should be able to edit The Task.
169
+
- :User: should be able to edit :Task:.
141
170
142
-
- The User should be able to mark The Task as completed.
171
+
- :User: should be able to mark :Task: as completed.
143
172
```
144
173
145
174
Functional requirements are rendered incrementally one by one. Consequently earlier functional requirements cannot reference later functional requirements.
@@ -159,7 +188,7 @@ Here's an example of a "Hello, World" application with one acceptance test.
159
188
160
189
***Acceptance Tests:***
161
190
162
-
- The App shouldn't show logging output in the console output (neither in stdout nor stderr).
191
+
- :App: shouldn't show logging output in the console output (neither in stdout nor stderr).
163
192
```
164
193
165
194
Acceptance tests extend **conformance tests**. The acceptance tests are implemented according to the ***Test Requirements:*** specification (see next section).
@@ -173,7 +202,7 @@ The `***Test Requirements:***` specification is a list of instructions that stee
173
202
Here's an example specification of test requirements.
174
203
175
204
```plain
176
-
- The Conformance Tests of The Program should be implemented in Python using Unittest framework.
205
+
- :ConformanceTests: of :App: should be implemented in Python using Unittest framework.
177
206
```
178
207
179
208
# Extended Syntax
@@ -183,7 +212,7 @@ Here's an example specification of test requirements.
183
212
Lines starting with `>` are ignored when rendering software code.
184
213
185
214
```plain
186
-
> This is an example of a comment in Plain
215
+
> This is an example of a comment in ***plain
187
216
```
188
217
189
218
## Template System
@@ -204,49 +233,14 @@ If you include a link using the markdown syntax, the linked resource will be pas
204
233
Here's an example of a linked resource (see Task manager example application for the full specification).
205
234
206
235
```plain
207
-
- Show The Task List. The details of the user interface are provided in the file [task_list_ui_specification.yaml](task_list_ui_specification.yaml).
236
+
- Show :Task: List. The details of the user interface are provided in the file [task_list_ui_specification.yaml](task_list_ui_specification.yaml).
208
237
```
209
238
210
239
**Important Notes:**
211
240
- Only links to files in the same folder (and its subfolders) as the Plain specification are supported. Links to external resources are not supported.
212
241
- File paths are resolved relative to the location of the Plain specification file.
213
242
- All types are supported, except binary files.
214
243
215
-
### Hierarchical Resource Visibility
216
-
217
-
Due to the hierarchical structure of the Plain specification, file attachments follow a scoping rule: **a functional requirement can only access linked resources that are defined in its own section or in any parent section**.
218
-
219
-
Here's an example demonstrating this hierarchical nature:
220
-
221
-
```plain
222
-
# Section 1
223
-
224
-
***Non-Functional Requirements:***
225
-
226
-
- Simple non-functional requirement with [file_attachment_1.yaml](file_attachment_1.yaml)
227
-
228
-
# Section 2
229
-
230
-
***Non-Functional Requirements:***
231
-
232
-
- Simple non-functional requirement with [file_attachment_2.yaml](file_attachment_2.yaml)
233
-
234
-
## Section 2.1
235
-
236
-
***Functional Requirements:***
237
-
238
-
- Simple functional requirement with [file_attachment_2_1.yaml](file_attachment_2_1.yaml)
- ❌ `file_attachment_1.yaml` - sibling section (Section 1), not accessible
245
-
246
-
This hierarchical scoping ensures that resources are properly encapsulated and prevents accidental access to unrelated files.
247
-
248
-
This design allows you to optimize context size by attaching only the necessary resources to the functional requirements that need them, improving the performance of the rendering process.
249
-
250
244
## Liquid templates
251
245
252
246
Plain supports Liquid templates. Liquid is an open-source template language created by Shopify (https://shopify.github.io/liquid/).
0 commit comments