Aug 13, 2022Kuina-chan

1Kuin Comment
1.1Multi-line Comment
- The part enclosed by "{" and "}" is considered as a single space character at compile time.
- Multi-line comments can be nested. For example, it can be written as "{{{comment}}}".
- The "{" and "}" in char literals and []char literals are considered to be characters or strings, not comments.
- Multi-line comments can be written even in the middle of a line, and can span multiple lines as a comment.
Reason For The Design
The notation for using "{" and "}" for multi-line comments comes from Pascal.
The C language comments "/*" and "*/" cannot be nested, so if the commented-out part contained comments, the "*/" in the middle would match and could not be commented out correctly. Therefore, Kuin allows comments to be nested.
1.2Single-line Comment
- A single-line comment cannot start in the middle of a line, and the first character of the line must be a ";" except for whitespace characters.
- A ";" in a char literal or []char literal is considered a character, not a comment.
- When multi-line comments, single-line comments, char literals, and []char literals are mixed, the first one to appear takes precedence.
Reason For The Design
The notation of using ";" for single-line comments comes from the x86 assembler.
The reason for adopting "{", "}", and ";" as symbols for comments was decided by a method of elimination, as it is desirable not to duplicate symbols used in operators.
2Line Splitting
- func f()
- do @g
- |(
- |2 + 3,
- |@a * @b,
- |@h()
- |)
- end func
- If the next character after a newline is "|", except for whitespace, the newline and "|" are assumed to be absent, and it is assumed to be a single whitespace character at compile time.
- Lines cannot be separated by "|" in character literals and in string literals.
Reason For The Design
In Visual Basic and C macros, when you want to start a new line in the middle of a line, you need to put a specific character at the end of the line, but in Kuin, important information is gathered at the beginning of a line, so I made it so that you can determine if you are starting a new line or not.