diff options
author | Bad Diode <bd@badd10de.dev> | 2024-06-14 17:55:51 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2024-06-14 17:55:51 +0200 |
commit | 3aae2f36047e9adc6a59b886492254eb4370777d (patch) | |
tree | 7d8f8fc069393dd38e9688d8d7cf77117ba5235f /README.md | |
parent | deaf192df939c9ec9a62ef4febaf76ade0dcbb01 (diff) | |
download | bdl-3aae2f36047e9adc6a59b886492254eb4370777d.tar.gz bdl-3aae2f36047e9adc6a59b886492254eb4370777d.zip |
Starting fresh with the `badlang`
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -131,7 +131,8 @@ cond (10 == 1) { | |||
131 | /* any unicode rune really really */ | 131 | /* any unicode rune really really */ |
132 | <character> ::= [a-z] | [A-Z] | 132 | <character> ::= [a-z] | [A-Z] |
133 | <string> ::= "\"" <character>+ "\"" | 133 | <string> ::= "\"" <character>+ "\"" |
134 | <comment> ::= ";" <character>* | 134 | <comment> ::= ";" <character>* "\n" |
135 | <newline> ::= "\n" | ||
135 | /* notably the symbol can't be a reserved word or start with a numeric value, modify later */ | 136 | /* notably the symbol can't be a reserved word or start with a numeric value, modify later */ |
136 | <symbol> ::= <character>+ | 137 | <symbol> ::= <character>+ |
137 | <nil> ::= "nil" | 138 | <nil> ::= "nil" |
@@ -157,8 +158,9 @@ cond (10 == 1) { | |||
157 | | "match" <expression> <case>+ | 158 | | "match" <expression> <case>+ |
158 | 159 | ||
159 | /* variables and functions */ | 160 | /* variables and functions */ |
160 | <vardecl> ::= "let" <symbol> <type>? ("=" <expression>)? | 161 | <varpair> ::= <symbol> <type> | <symbol> <type>? "=" <expression> |
161 | | "let" "(" (<symbol> <type>? ("=" <expression>)?)+ ")" | 162 | <vardecl> ::= "let" <varpair> |
163 | | "let" "{" <varpair>+ "}" | ||
162 | 164 | ||
163 | <fundecl> ::= "fun" <symbol> "(" <argument>* ")" <type>* <expression> | 165 | <fundecl> ::= "fun" <symbol> "(" <argument>* ")" <type>* <expression> |
164 | <argument> ::= <symbol> <type>? ("=" <literal>)? | 166 | <argument> ::= <symbol> <type>? ("=" <literal>)? |
@@ -171,7 +173,7 @@ cond (10 == 1) { | |||
171 | | "while" <vardecl> <expression> <expression> | 173 | | "while" <vardecl> <expression> <expression> |
172 | 174 | ||
173 | <assignment> ::= "set" <symbol> "=" <expression> | 175 | <assignment> ::= "set" <symbol> "=" <expression> |
174 | | "set" "(" (<symbol> "=" <expression>)+ ")" | 176 | | "set" "{" (<symbol> "=" <expression>)+ "}" |
175 | 177 | ||
176 | <expression> ::= <equality> | 178 | <expression> ::= <equality> |
177 | <equality> ::= <comparison> ( ( "!=" | "==" ) <comparison>)* | 179 | <equality> ::= <comparison> ( ( "!=" | "==" ) <comparison>)* |