Rail Document

Rail is used to represent concepts and structures.

Below is an example implementation using Rail code to represent the structure of this document:

% chapter = _ ? _ 

# Rail\_Documentation
  + Element < chapter ! 1 
    |
    
  + Auxiliary Lines < chapter ! 2 
    |
    
  + Rail < chapter ! 3 
    |
    
  + Category < chapter ! 4 
    |
    
  + Reference < chapter ! 5 
    |
    
  + Aggregate < chapter ! 6 
    |
    
  + Import < chapter ! 7 
    |
    
Rail\_Documentation #

For detailed language rules, refer to Line Types

1. Element

The basic element of Rail code is called an element, which describes various concepts using names.

Generally, it is a string without spaces.

This\_is\_a\_line\_of\_text, without\_spaces.

If the content of the element is omitted, it can be represented by an underscore _, a newline.

To make the code easier to read, Rail’s omissions are explicit, i.e., they cannot be empty.

_

Rail supports two types of line breaks.
Because it does not support inserting spaces in elements, _ can be used to represent an empty space.

Rail\_Document

Additionally, \\ can be used to represent an actual newline.

This has 2 \:\\\\

2. Auxiliary Structures

Sometimes using spaces makes the code easier to read.


Lines starting with : have no actual meaning and are considered empty lines. They are generally used to indicate that a line or several lines have been omitted.
If followed by an element, it is a comment.

| This\_line\_is\_a\_comment.

If this line is just a simple :, it can be considered an implicit comment. However, Rail’s omissions are explicit, so this type of structure is recognized as an empty line.

|

3. Rail

Rail is one of the four core objects of Rail, with the other three being Category, Reference, and Aggregate.

Rail bind two elements, which is a rail. Of course, * can be a _.

= is used to bind the name parameter on the left and the value parameter on the right.

For different lines, different rails can have the same name because the position of the lines can distinguish them.

* = *

For example:

bing = https://www.bing.com

This means that at a certain line, the name bing has the value https://www.bing.com.

4. Category

Category is a line starting with +, used to create a subdomain.

Use two spaces to indicate the subdomain. The subdomain ends when it is reduced to a certain level.

+ *
  |

For example:

+ Websites
  bing = https://www.bing.com
  youtube = https://www.youtube.com
  github = https://www.github.com

Just like each chapter of a book has a preface, which is allowed to have a value in language design, the details can be understood as the category of a subdomain. However, the name of the category allows repetition.

+ * = *
  |

Just like file folders can be nested, category can also be nested.

+ *
  |
  + *
    |
  |
|

5. Reference

A reference can be understood as a reference to a Rail.

Define a reference as follows:

It can be defined by an element.

% *

It can be defined by a Rail.

% * = *

Implement a reference as follows:

According to the name parameter of the information to specify the information.

:
* % *

After defining the information, it can be implemented, and it can be implemented multiple times.

For example:

% ref = A
:
a % ref
a % ref
a % ref

This is equivalent to:

a = A
a = A
a = A

Regarding information, there is a shadowing mechanism. If an reference is defined and then another reference with the same name is defined, the former will not work after the latter’s subdomain ends. If both are defined in the same subdomain, it is equivalent to substitution.

# ref = A
+ Cat
  # ref = B
  # ref = C
  c # ref
a # ref

Another way to use reference is similar to templating.

# * = * ? *
* # * ! *

For example:

# web = https://www. ? .com

bing # web bing
youtube # web youtube
github # web github

6. Aggregate

An Aggregate can be understood as the category of positions. It can be implemented first and then defined, or defined and then implemented in another aggregate. It can be defined in one file and then implemented in another file. To prevent various complex situations, a aggregate can only be implemented once.

# *
  |
|
* #

The lines at * > will be replaced and expanded to > * and its subdomain. The above code is equivalent to:

|
+ *
  :

Because an aggregate is essentially a transfer, the subdomain context can achieve transmission to definition.

| S1's definition
S1 #

: S1's implementation
# S1
  % ref = A
  a % ref
  
  : S2's implementation
  S2 #
  
% ref = B
| At this point, ref's value is A,not B.
a % ref 

7. Import

A file is composed with root, and it can be introduced like a distribution.

@ *
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值