Updated readme with the table of special characters

This commit is contained in:
The other zerg 2022-09-26 13:53:17 +02:00
parent fed9cc4a29
commit 29fd400027
2 changed files with 37 additions and 0 deletions

View File

@ -15,3 +15,39 @@
- -
- Final implementation in rust? Althought rantlr4 doesn't have rust support. So we will have to write parser and lexer from sctach - Final implementation in rust? Althought rantlr4 doesn't have rust support. So we will have to write parser and lexer from sctach
| character | meaning | p | z |
|-----------|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ~ | Unused | Negation | |
| ` | Unused | Infix maybe | |
| ! | Unused | unsafe unwrap, far future | |
| @ | Unused | maybe a valid starting character for ID | |
| # | Comments | Use # for single line ## for multiline comments | |
| $ | Unused | I don't like using this anywhere. Useless. | |
| % | OP_MOD | | |
| ^ | OP_POWER | Not xor. | |
| & | OP_AND | Not bitwise and. | |
| * | OP_MULT | | |
| ( | Grouping | Also range, non inclusive | |
| ) | Grouping | Also range, non inclusive | |
| - | OP_MINUS, Number negation | Maybe in ranges? - makes more sense than .. however that becomes a problem with negative numbers, unless we force the whistespace | |
| _ | Unused | Not sure, doesn't seem like a useful symbol. we could use it for digit grouping in integers like a lot of modern languages do | |
| = | OP_EQUALS | | |
| + | OP_PLUS | Not allowed as a number prefix. It's ugly and serves no purpose. +X is X. - is useful to flip the sign, we shouldn't add this 'for symetries' | |
| [ | Unused | Inclusive Range | |
| ] | Unused | Inclusive range | |
| { | Unused | Should be used to define a struct. { WS NL fields functions NL } NL | |
| } | Unused | struct close | |
| ; | Unused | no idea. | |
| : | Type prefix. very nice. | Very nice. | |
| " | Unused | No idea. | |
| ' | Strings | Should be used both for single and multiline strings. Should be able to specify multiple in a row in order to require that many to close without escaping any lower number of quotes in the string | |
| PIPE LOl | OP_OR | | |
| < | OP_LESS_THAN | | |
| > | OP_GREATER_THAN | | |
| , | Unused | ? | |
| . | Unused | Object navigation is an obvious one, but I'd like to explore other possiblities. One idea is to have . act as a "value of the expression in the line above, which would be very useful for using values without assigning them to variables, 'auto piping' | |
| ? | Unused | Prefix for 'if' and 'switch' like thing. ? EXPR NL INDENT (VAL WS expr)+ (_ WS expr)? | |
| / | OP_DIV | | |
| \ | UNUSED | I'm not 100% opposed but i don't like the idea of using this as an escape character. | |

View File

@ -74,6 +74,7 @@ functionParam: ID WS TYPE ;
functionBody: ((INDENT expr | SingleLineComment | MultiLineComment) NL)+ ; functionBody: ((INDENT expr | SingleLineComment | MultiLineComment) NL)+ ;
functionCall: ID WS expr (WS expr)* ; functionCall: ID WS expr (WS expr)* ;
// expr // expr
expr: literal expr: literal
| ID | ID