Skip to content

Commit b6e45fb

Browse files
committed
Update plain language specification
1 parent fb0dce6 commit b6e45fb

File tree

1 file changed

+65
-71
lines changed

1 file changed

+65
-71
lines changed

docs/plain_language_specification.md

Lines changed: 65 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Overview
22

3-
## About Plain programming language
3+
## About ***plain programming language
44

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.
66

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*.
88

99
## Syntax
1010

11-
Plain language is structured English based on markdown syntax.
11+
***plain language is structured English based on markdown syntax.
1212

13-
Here's an example of a "hello,world" program in Plain.
13+
Here's an example of a "hello, world" program in ***plain.
1414

1515
```plain
1616
***Non-Functional Requirements:***
1717
18-
- Implementation should be in Python.
18+
- :Implementation: should be in Python.
1919
2020
***Functional Requirements:***
2121
@@ -26,7 +26,7 @@ Here's an example of a "hello,world" program in Plain.
2626

2727
## Source organization
2828

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.
3030

3131
```plain
3232
# Section 1
@@ -35,15 +35,30 @@ Plain source can be organized in sections and subsection using markdown headers.
3535
3636
***Non-Functional Requirements:***
3737
38-
- Simple non-functional requirement
38+
- First simple non-functional requirement
39+
40+
***Functional Requirements:***
41+
42+
- First simple functional requirement
3943
4044
## Section 2.1
4145
46+
***Non-Functional Requirements:***
47+
48+
- Second simple non-functional requirement
49+
4250
***Functional Requirements:***
4351
44-
- Simple functional requirement
52+
- Second simple functional requirement
4553
```
4654

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+
4762
### Specifications
4863

4964
There are four types of specifications:
@@ -59,26 +74,40 @@ Functional requirements must reside in leaf sections while other specifications
5974

6075
## Definitions
6176

62-
The `***Definitions:***` specification is a list of definitions of new terms.
77+
The `***Definitions:***` specification is a list of definitions of new concepts.
6378

6479
Here's an example of a simple definiton.
6580

6681
```plain
67-
- The App implements a task manager application.
82+
- :App: implements a task manager application.
6883
```
6984

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:
7188

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.
73102

74103
```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.
80105
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+
```
82111

83112
## Non-Functional Requirements
84113

@@ -87,24 +116,24 @@ The `***Non-Functional Requirements:***` specification is a list of instructions
87116
Here's an example of a simple instruction specifying only that the Plain specification should be rendered to Python software code.
88117

89118
```plain
90-
- Implementation should be in Python.
119+
- :Implementation: should be in Python.
91120
```
92121

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.
94123

95124
Here's an example of more complex instructions.
96125

97126
```plain
98-
- Implementation of The Program should be in Python (The Implementation).
127+
- :Implementation: of :App: should be in Python.
99128
100-
- The Implementation should include unit tests using Unittest framework (The Unittests).
129+
- :Implementation: should include unit tests using Unittest framework.
101130
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
103132
```
104133

105134
## Functional Requirements
106135

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.
108137

109138
Here's an example of a simple description of the functionality of the "hello, world" application.
110139

@@ -115,7 +144,7 @@ Here's an example of a simple description of the functionality of the "hello, wo
115144
Each functional requirement must be limited in complexity. For example, for the functional requirement
116145

117146
```plain
118-
- Implement a task manager application.
147+
- :App: should implement a task manager application.
119148
```
120149

121150
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
129158
Here's an example how to do such a break down in the case of a task manager application.
130159

131160
```plain
132-
- Implement the entry point for The App.
161+
- Implement the entry point for :App:.
133162
134-
- Show The Task List.
163+
- Show :Task: List.
135164
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.
137166
138-
- The User should be able to delete The Task.
167+
- :User: should be able to delete :Task:.
139168
140-
- The User should be able to edit The Task.
169+
- :User: should be able to edit :Task:.
141170
142-
- The User should be able to mark The Task as completed.
171+
- :User: should be able to mark :Task: as completed.
143172
```
144173

145174
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.
159188
160189
***Acceptance Tests:***
161190
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).
163192
```
164193

165194
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
173202
Here's an example specification of test requirements.
174203

175204
```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.
177206
```
178207

179208
# Extended Syntax
@@ -183,7 +212,7 @@ Here's an example specification of test requirements.
183212
Lines starting with `>` are ignored when rendering software code.
184213

185214
```plain
186-
> This is an example of a comment in Plain
215+
> This is an example of a comment in ***plain
187216
```
188217

189218
## Template System
@@ -204,49 +233,14 @@ If you include a link using the markdown syntax, the linked resource will be pas
204233
Here's an example of a linked resource (see Task manager example application for the full specification).
205234

206235
```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).
208237
```
209238

210239
**Important Notes:**
211240
- Only links to files in the same folder (and its subfolders) as the Plain specification are supported. Links to external resources are not supported.
212241
- File paths are resolved relative to the location of the Plain specification file.
213242
- All types are supported, except binary files.
214243

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)
239-
```
240-
241-
**Resource visibility for Section 2.1:**
242-
-`file_attachment_2_1.yaml` - same section
243-
-`file_attachment_2.yaml` - parent section (Section 2)
244-
-`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-
250244
## Liquid templates
251245

252246
Plain supports Liquid templates. Liquid is an open-source template language created by Shopify (https://shopify.github.io/liquid/).

0 commit comments

Comments
 (0)