From e9fd20bfe5f71e0e45769134399099cc0f31968a Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 9 Jun 2019 01:12:19 -0700 Subject: [PATCH] A few more fixes to EBNF --- TODO.md | 2 -- schala-lang/language/src/parsing.rs | 11 ++++------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/TODO.md b/TODO.md index 50b63ce..91e05ae 100644 --- a/TODO.md +++ b/TODO.md @@ -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 diff --git a/schala-lang/language/src/parsing.rs b/schala-lang/language/src/parsing.rs index 8af6ad8..dace2c2 100644 --- a/schala-lang/language/src/parsing.rs +++ b/schala-lang/language/src/parsing.rs @@ -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