Skip to content

Commit 3626655

Browse files
authored
Merge branch 'mono/dev' into ptree
2 parents 8fb19c0 + c4083c5 commit 3626655

File tree

95 files changed

+10669
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+10669
-5
lines changed

pkgs/jaml/README.md

Whitespace-only changes.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# MEP-000: Introduction and Overview
2+
3+
## 1. Abstract
4+
5+
This proposal introduces our new markup language—a configuration format designed to be simple, human‐readable, and expressive. Drawing inspiration from established formats like TOML, YAML, and JSON, our language extends their core concepts with enhanced support for dynamic evaluation, explicit type annotations, and rich structural constructs. MEP-000 outlines the overarching goals, design principles, and key features that will guide the subsequent enhancement proposals (MEPs) for this language.
6+
7+
---
8+
9+
## 2. Motivation
10+
11+
### 2.1. Simplicity and Readability
12+
13+
- **Human-Readable Syntax:**
14+
Our language aims to maintain the clarity and simplicity of TOML, ensuring that configuration files remain accessible and easy to edit by humans.
15+
16+
- **Minimalistic Design:**
17+
The syntax is designed to be lightweight and unambiguous, reducing the learning curve while still providing powerful capabilities.
18+
19+
### 2.2. Enhanced Expressiveness
20+
21+
- **Static and Dynamic Constructs:**
22+
In addition to standard static data types, the language supports dynamic evaluation. This enables configurations to adapt based on external context (such as environment variables) or computed values.
23+
24+
- **Scoped Variables:**
25+
Variables can be defined and referenced within multiple scopes—global, table-local (self), and context-specific—allowing for flexible configuration strategies.
26+
27+
### 2.3. Structural Flexibility
28+
29+
- **Hierarchical Organization:**
30+
Inspired by TOML, our language supports sections (tables), table arrays, inline tables, and lists of inline tables, enabling users to organize configurations in a modular and logical manner.
31+
32+
- **Multiline Preservation:**
33+
Multiline strings, arrays, and inline tables retain their formatting, ensuring that embedded documentation, code snippets, or lengthy texts remain exactly as authored.
34+
35+
### 2.4. Interoperability and Extensibility
36+
37+
- **Mapping to Existing Standards:**
38+
The language is designed to map neatly to existing formats such as TOML, JSON, and YAML, facilitating integration with current tools and workflows.
39+
40+
- **Future-Proofing:**
41+
The design anticipates future enhancements such as dynamic evaluation of expressions, integration with external schema definitions, and advanced type checking.
42+
43+
---
44+
45+
## 3. Key Features
46+
47+
### 3.1. Data Types and Structures
48+
49+
- **Scalar Types:**
50+
Support for strings (including multiline strings), integers (decimal, octal, hexadecimal, binary), floats (with special values like `inf` and `nan`), booleans, and null.
51+
52+
- **Collection Types:**
53+
Arrays (inline and multiline), inline tables, standard tables (sections), and table arrays, as well as lists of inline tables.
54+
55+
- **Type Annotations:**
56+
Optional annotations provide clarity on expected data types and serve as documentation for validation and tooling.
57+
58+
### 3.2. Dynamic Evaluation
59+
60+
- **Evaluation Enclosures:**
61+
The language distinguishes between static values and dynamically evaluated expressions. Dynamic constructs allow the configuration to adapt based on runtime or external context.
62+
63+
- **Evaluation Timing:**
64+
Support for load-time, render-time, and mixed evaluation modes ensures that users can precisely control when expressions are resolved.
65+
66+
### 3.3. Scoped Variables
67+
68+
- **Global Scope:**
69+
Variables defined in a global section, referenced with a designated symbol (e.g., `@{...}`), are available throughout the configuration.
70+
71+
- **Self (Table-Local) Scope:**
72+
Variables defined within a table are resolved locally, allowing overrides of global defaults.
73+
74+
- **Context Scope:**
75+
Variables provided externally (via context during rendering) are referenced with a specific notation (e.g., `${...}`) and enable dynamic configuration.
76+
77+
### 3.4. File and Git Referencing
78+
79+
- **File Referencing:**
80+
The language can incorporate external file content through explicit syntax, enabling modular configuration management.
81+
82+
- **Git Referencing:**
83+
Integration with Git repositories allows for version-controlled configurations and dynamic inclusion of external content.
84+
85+
### 3.5. Multiline and Preservation Features
86+
87+
- **Multiline Strings:**
88+
Support for triple-quote syntax preserves newlines, indentation, and formatting exactly as written.
89+
90+
- **Multiline Arrays and Inline Tables:**
91+
Arrays and inline tables may span multiple lines, preserving both order and readability.
92+
93+
- **List of Inline Tables:**
94+
Inline tables can be used as elements within an array to represent lists of dictionaries, enhancing modular data representation.
95+
96+
---
97+
98+
## 4. Comparison with Existing Formats
99+
100+
Our markup language draws on the strengths of formats like TOML by:
101+
- Maintaining a simple, clean syntax.
102+
- Supporting rich data types and hierarchical structures.
103+
- Extending these capabilities with dynamic evaluation and explicit type annotations.
104+
- Ensuring that all multiline and complex structures retain their original formatting.
105+
106+
---
107+
108+
## 5. Proposed MEP Roadmap
109+
110+
To fully realize the language's capabilities, subsequent MEPs will address specific feature areas:
111+
- **MEP-001:** Supported Data Types and Structural Elements
112+
- **MEP-002:** Support for Scoped Variables (Global, Self, Context)
113+
- **MEP-003:** Multiline Constructs and Preservation
114+
- **MEP-004:** Type Annotations and Validation
115+
- **MEP-005:** Dynamic Evaluation and Expression Handling
116+
- **MEP-006:** File Referencing and Embedding
117+
- **MEP-007:** Git Referencing and Integration
118+
- *Additional MEPs will cover conditional logic, external schema integration, and more.*
119+
120+
---
121+
122+
## 6. Conclusion
123+
124+
MEP-000 establishes the overall vision and design goals of our new markup language. It outlines a language that is both simple and powerful—maintaining the readability of TOML while extending its functionality to support dynamic evaluation, explicit type annotations, and a rich set of structural constructs. This foundational document provides the framework upon which the subsequent MEPs will build, ensuring a coherent and extensible specification.
125+
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
# MEP-001: Keywords, Operators, and Patterns
2+
3+
## 1. Abstract
4+
5+
This proposal specifies the reserved keywords, operators, punctuation, and common expression patterns for our markup language. It establishes clear rules for keyword usage, operator precedence, and syntax validation. Key updates include support for pipeline operations, enhanced string literal handling (with various quoting forms), conditional (ternary) expressions, membership and merge operators, and reserved functions like `File()` and `Git()`.
6+
7+
---
8+
9+
## 2. Motivation
10+
11+
- **Consistency and Clarity:**
12+
Defining keywords, operators, and punctuation prevents naming conflicts and ambiguous syntax, ensuring consistent parsing and predictable expression evaluation.
13+
14+
- **Avoiding Conflicts:**
15+
Reserving critical language constructs (keywords, functions, and punctuation) stops users from unintentionally overwriting core elements, which could lead to errors.
16+
17+
- **Enhanced Error Handling:**
18+
A well-defined syntax with reserved elements enables robust parsing and clear error messages, aiding debugging and future tooling integrations.
19+
20+
---
21+
22+
## 3. Specification
23+
24+
### 3.1. Reserved Keywords
25+
26+
The following identifiers are reserved and **cannot** be used as names for keys, tables, variables, or user-defined types:
27+
28+
- **Logical and Boolean Keywords:**
29+
- `true`, `false`, `null`, `is`, `not`, `and`, `or`
30+
- **Control Flow Keywords:**
31+
- `if`, **`elif`**, `else`, `for`, `in`
32+
- **Directive Keywords:**
33+
- `include`
34+
- **Special Functions:**
35+
- `File()`, `Git()`
36+
37+
#### Keyword Usage
38+
- Keywords must appear in the appropriate context (for example, `if` and `elif` in conditional expressions).
39+
- Using any of these reserved words as identifiers will result in a syntax error.
40+
41+
---
42+
43+
### 3.2. Reserved Punctuations and Brackets
44+
45+
#### 3.2.1. Reserved Punctuation Marks
46+
47+
The following punctuation marks are reserved and **must not** be used as part of key names, variable names, or unquoted strings:
48+
49+
- **Colon (`:`)** – For type annotations and key-value separation.
50+
- **Dot (`.`)** – For namespace access.
51+
- **Comma (`,`)** – As a separator in lists and inline tables.
52+
- **Equals Sign (`=`)** – For assignment in key-value pairs.
53+
- **Arrow (`->`)** – Reserved for potential functional expressions.
54+
- **Semicolon (`;`)** – Reserved for future extensions.
55+
- **Tilde (`~`)** – Used for load-time expressions.
56+
- **At Symbol (`@`)** – Global scope indicator.
57+
- **Dollar Sign (`$`)** – Context scope indicator.
58+
- **Percent Sign (`%`)** – Self (table-local) scope indicator.
59+
- **Less Than (`<`)** and **Greater Than (`>`)** – Used in comparisons.
60+
- **Exclamation Mark (`!`)** – For negation.
61+
- **Asterisk (`*`)** – For multiplication and comprehensions.
62+
- **Caret (`^`)** – Reserved for future use.
63+
- **Ampersand (`&`)** – Reserved for future use.
64+
- **Pipe (`|`)****Used as a pipeline operator** to chain operations.
65+
- **Forward Slash (`/`)** – In path strings and division.
66+
- **Backslash (`\`)** – As an escape character in strings.
67+
68+
#### 3.2.2. Reserved Bracket Combinations
69+
70+
All bracket types are reserved to ensure unambiguous syntax:
71+
72+
- **Round Brackets (`()`)** – For grouping expressions and function calls.
73+
- **Square Brackets (`[]`)** – For defining lists and accessing array elements.
74+
- **Curly Braces (`{}`)** – For inline tables and dictionary-like structures.
75+
- **Angle Brackets (`<>`)** – Reserved for future use.
76+
- **Nested Bracket Combinations:**
77+
- Examples: `[{}]`, `{{}}`, `<(>)`, `([)])`, `<{>}`
78+
These are reserved to avoid ambiguity.
79+
- **F-String Brackets (`f"{...}"`)** – For formatted string interpolation.
80+
81+
#### Punctuation Usage
82+
- Any use of reserved punctuation or bracket combinations outside their valid syntax context (or within unquoted identifiers) will raise a syntax error.
83+
84+
---
85+
86+
### 3.3. String Quotation Rules
87+
88+
Our markup language supports multiple string delimiters to handle both literal and interpolated content:
89+
90+
- **Single Quotes (`'...'`):**
91+
Basic strings with no interpolation.
92+
```toml
93+
greeting = 'Hello, World!'
94+
```
95+
- **Double Quotes (`"..."`):**
96+
Strings that support interpolation.
97+
```toml
98+
welcome = "Hello, ${user.name}!"
99+
```
100+
- **Triple Single Quotes (`'''...'''`):**
101+
Multi-line literal strings.
102+
```toml
103+
message = '''This is a
104+
multi-line string.'''
105+
```
106+
- **Triple Double Quotes (`"""..."""`):**
107+
Multi-line strings with interpolation.
108+
```toml
109+
announcement = """Version: ${version}
110+
Released Today!"""
111+
```
112+
- **Backticks (`` `...` ``):**
113+
Raw strings where no escaping is performed.
114+
```toml
115+
path = `C:\Users\Name`
116+
```
117+
- **F-Strings (`f"..."`):**
118+
For formatted strings with inline variable interpolation.
119+
```toml
120+
configPath = f"${base}/config.toml"
121+
```
122+
123+
#### String Quotation Guidelines
124+
- Mixing different string delimiters in one literal is not allowed.
125+
- Unescaped or mismatched quotes within a string will trigger a syntax error.
126+
127+
---
128+
129+
### 3.4. Supported Operators
130+
131+
#### 3.4.1. Arithmetic Operators
132+
- **Addition:** `+`
133+
- **Subtraction:** `-`
134+
- **Multiplication:** `*`
135+
- **Division:** `/`
136+
- **Modulo:** `%`
137+
- **Exponentiation:** `**`
138+
139+
#### 3.4.2. Comparison Operators
140+
- **Equal to:** `==`
141+
- **Not equal to:** `!=`
142+
- **Greater than:** `>`
143+
- **Less than:** `<`
144+
- **Greater than or equal to:** `>=`
145+
- **Less than or equal to:** `<=`
146+
- **Identity:** `is`
147+
148+
#### 3.4.3. Logical Operators
149+
- **Logical AND:** `and`
150+
- **Logical OR:** `or`
151+
- **Logical NOT:** `not`
152+
153+
#### 3.4.4. Pipeline Operator
154+
- Chains operations together in a readable sequence:
155+
```toml
156+
result = ~( data | transform | filter )
157+
```
158+
159+
#### 3.4.5. Conditional (Ternary) Operator
160+
- Allows inline conditional expressions:
161+
```toml
162+
status = ~( "Active" if is_active else "Inactive" )
163+
```
164+
165+
#### 3.4.6. String Concatenation and Interpolation
166+
- **Concatenation:** Using the `+` operator.
167+
- **Interpolation:** Via f-string syntax:
168+
```toml
169+
full_path = f"${base}/docs"
170+
```
171+
172+
#### 3.4.7. Membership Operators
173+
- **Membership:** `in`
174+
- **Non-membership:** `not in`
175+
176+
#### 3.4.8. Merge Operator
177+
- Used for table or inline table merging:
178+
```toml
179+
[production]
180+
<< = default_config
181+
```
182+
183+
---
184+
185+
### 3.5. Error Handling
186+
187+
- **Syntax Errors:**
188+
- Reserved keywords or punctuation misused as identifiers will result in a syntax error.
189+
- Incorrect use of reserved functions (`File()`, `Git()`) or keywords (such as using `if` or `elif` as variable names) is not permitted.
190+
- **Bracket Errors:**
191+
- Unmatched, incorrectly nested, or ambiguous bracket combinations will trigger an error.
192+
- **Invalid Punctuation:**
193+
- Reserved punctuation appearing outside of its valid syntax (or within unquoted keys/identifiers) will raise a clear error.
194+
- **String Delimiter Errors:**
195+
- Mismatched or unescaped quotes in strings will cause a syntax error.
196+
197+
---
198+
199+
## 4. Examples
200+
201+
### Example 1: Pipeline Operation
202+
203+
```toml
204+
[processing]
205+
output = ~( data | sanitize | format )
206+
```
207+
208+
### Example 2: Valid Use of Reserved Keywords and Conditional Expression
209+
210+
```toml
211+
[config]
212+
is_active = true
213+
status = ~( "Running" if is_active else "Stopped" )
214+
```
215+
216+
### Example 3: Reserved Function Usage
217+
218+
```toml
219+
[dependencies]
220+
source = File("requirements.txt")
221+
version = Git("https://repo.git", tag="v1.0")
222+
```
223+
224+
### Example 4: Membership and Merge Operators
225+
226+
```toml
227+
[settings]
228+
allowed = ~( "admin" in user.roles )
229+
merged_config = default << user_override
230+
```
231+
232+
### Example 5: Invalid Use of Reserved Punctuation
233+
234+
```toml
235+
[invalid]
236+
some:key = "value" # Syntax error: Colon used incorrectly in key name
237+
```
238+
239+
### Example 6: Invalid Use of Reserved Keyword
240+
241+
```toml
242+
[config]
243+
if = "condition" # Syntax error: 'if' is a reserved keyword
244+
```
245+
246+
---
247+
248+
## 5. Open Issues
249+
250+
- **Future Reserved Symbols:**
251+
Evaluate whether symbols such as `^`, `&`, or certain bracket combinations should have dedicated functionality.
252+
- **Keyword Expansion:**
253+
Consider if additional keywords (e.g., `match`) need to be reserved as language features evolve.
254+
- **Operator Overloading:**
255+
Determine if custom operator definitions for user-defined types are desirable.
256+
- **Pipeline Syntax Complexity:**
257+
Investigate supporting more complex chaining scenarios or error reporting for pipelines.
258+
259+
---
260+
261+
## 6. Conclusion
262+
263+
MEP-001 clearly defines the reserved keywords, operators, punctuation, and syntax patterns for our markup language. By reserving key elements such as control flow keywords (including `elif`), special functions (`File()`, `Git()`), and specific punctuation and bracket combinations, the specification prevents naming conflicts and ambiguity. Enhanced support for pipelines, conditional expressions, membership tests, and string handling ensures that the language remains both expressive and robust. Feedback is encouraged as we continue refining these rules and explore future language enhancements.

0 commit comments

Comments
 (0)