A few more fixes to EBNF

This commit is contained in:
greg 2019-06-09 01:12:19 -07:00
parent dfbd951aaf
commit e9fd20bfe5
2 changed files with 4 additions and 9 deletions

View File

@ -15,8 +15,6 @@ print the generated type variable for every subexpression in an expression
-idea: the `type` declaration should have some kind of GADT-like syntax
-idea: I should make the BNF grammar part of the documentation...
- Idea: if you have a pattern-match where one variant has a variable and the other lacks it
instead of treating this as a type error, promote the bound variable to an option type

View File

@ -80,9 +80,9 @@
//!
//! ```
//! list_expr := "[" (expression, ",")* "]"
//! lambda_expr := "\" lambda_param_list type_anno+ nonempty_func_body
//! lambda_expr := "\\" lambda_param_list type_anno+ nonempty_func_body
//! lambda_param_list := formal_param_list | formal_param
//! paren_expr := LParen paren_inner RParen
//! paren_expr := "(" paren_inner ")"
//! paren_inner := (expression ",")*
//! identifier_expr := named_struct | IDENTIFIER
//! ```
@ -94,14 +94,11 @@
//! record_block := "{" (record_entry, ",")* | "}" //TODO support anonymus structs, update syntax
//! record_entry := IDENTIFIER ":" expression
//! anonymous_struct := TODO
//! ```
//!
//! A `float_literal` can still be assigned to an int in type-checking
//! ```
//! number_literal := int_literal | float_literal
//! int_literal = ("0x" | "0b") digits
//! float_literal := digits ("." digits)
//! digits := (DIGIT_GROUP underscore)+
//! digits := (digit_group underscore*)+
//! digit_group := DIGIT+
//! ```
//!
//! ### Patterns