rsplt issueshttps://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues2017-05-20T20:23:40+02:00https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/1What to do with whitespace2017-05-20T20:23:40+02:00Gerdriaan MulderWhat to do with whitespaceFrom the grammar:
* `VarDecl = ( 'var' | Type ) id '=' Exp ';'`
* `Exp = ...`
* `id = alpha ( '_' | alphaNum )*`
What do we do with input `varavaravarava=123;` as a variable declaration:
1. Variable name `avaravarava` and variable...From the grammar:
* `VarDecl = ( 'var' | Type ) id '=' Exp ';'`
* `Exp = ...`
* `id = alpha ( '_' | alphaNum )*`
What do we do with input `varavaravarava=123;` as a variable declaration:
1. Variable name `avaravarava` and variable value `123`?
2. "Parse" error, because we want an explicit `' '` between `var` and the variable name?
3. ...?
Arguably, both options have their merit. Depending on the type of 'peeking' (lookahead / lookbehind), the scanner can be either very simple or already look like a parser.
Also, what to do with other types of whitespace: `\t`, `\n`, `\r`...https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/2scanner: implement missing features2017-05-20T20:23:40+02:00Amber Sprenkelsd.sprenkels@cs.ru.nlscanner: implement missing features- [x] Literal characters
- [x] Comments (`/* ... */`, and `// ...`)- [x] Literal characters
- [x] Comments (`/* ... */`, and `// ...`)Gerdriaan MulderGerdriaan Mulderhttps://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/4scanner: rename to lexer?2017-05-20T20:23:40+02:00Amber Sprenkelsd.sprenkels@cs.ru.nlscanner: rename to lexer?`scanner` is a widely used name for the input-buffer reading device. However, `lexer` is a more used and less ambiguous name.
I propose to change te code to use the word `lexer`, instead of `scanner`.`scanner` is a widely used name for the input-buffer reading device. However, `lexer` is a more used and less ambiguous name.
I propose to change te code to use the word `lexer`, instead of `scanner`.https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/5build reasonable error reporting2017-05-20T20:23:40+02:00Amber Sprenkelsd.sprenkels@cs.ru.nlbuild reasonable error reportingProposal example error:
```
src/filename.spl:20,{18-27} error: unexpected identifier 'remainder'
src/filename.spl:20: mooncycle = 3 remainder;
^~~~~~~~~
```Proposal example error:
```
src/filename.spl:20,{18-27} error: unexpected identifier 'remainder'
src/filename.spl:20: mooncycle = 3 remainder;
^~~~~~~~~
```https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/6Pretty printer2017-05-20T20:23:40+02:00Gerdriaan MulderPretty printerThe pretty printer should output the result of the lexer in such a way that the output can be used again in the lexer.The pretty printer should output the result of the lexer in such a way that the output can be used again in the lexer.Assignment 1https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/7Assignment 1: deliverables2017-05-20T20:23:40+02:00Gerdriaan MulderAssignment 1: deliverables* [x] Presentation
* [x] Construction of the parser
* [x] Demonstration of the parser
* [x] Implementation (language, changes to the grammar, interesting points)
* [x] Document
* [x] Transformed grammar
* [ ] Semantic ana...* [x] Presentation
* [x] Construction of the parser
* [x] Demonstration of the parser
* [x] Implementation (language, changes to the grammar, interesting points)
* [x] Document
* [x] Transformed grammar
* [ ] Semantic analysisAssignment 1https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/8Operator precedence2017-05-20T20:23:40+02:00Gerdriaan MulderOperator precedenceFor the arithmetic operators we should follow the `HMVDWOA` (braces, exponentiation, multiplication, division, root, addition, subtraction).
What to do with the other operators? I.e. the unary `!`, `-`, and the binary `==`, `<`, `>`, ...For the arithmetic operators we should follow the `HMVDWOA` (braces, exponentiation, multiplication, division, root, addition, subtraction).
What to do with the other operators? I.e. the unary `!`, `-`, and the binary `==`, `<`, `>`, `<=`, `>=`, `!=`, `&&`, `||`, `:`.Assignment 1https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/10Provide a reasonal span on an unexpected EOF2017-05-20T20:23:40+02:00Amber Sprenkelsd.sprenkels@cs.ru.nlProvide a reasonal span on an unexpected EOFI propose that we let the scanner add one EOF at the end of the string of scanned tokens. This way, we know what the span is, when we encounter an unexpected end-of-file.I propose that we let the scanner add one EOF at the end of the string of scanned tokens. This way, we know what the span is, when we encounter an unexpected end-of-file.https://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/12Fix `allow(unused_assignments)` error suppressing2017-05-20T20:23:40+02:00Amber Sprenkelsd.sprenkels@cs.ru.nlFix `allow(unused_assignments)` error suppressingand just use the new `peek_token!` macro.and just use the new `peek_token!` macro.Amber Sprenkelsd.sprenkels@cs.ru.nlAmber Sprenkelsd.sprenkels@cs.ru.nlhttps://gitlab.science.ru.nl/dsprenkels/rsplt/-/issues/13trait Add for ErrorAndSpan2017-05-20T20:23:40+02:00Amber Sprenkelsd.sprenkels@cs.ru.nltrait Add for ErrorAndSpanAt the moment, we propagate parsing errors pretty random up through the call stack when they occur. I propose that we implement the `std::ops::BitOr` trait, so we can use constructs like this:
```rust
let eas = yield_parse!(Exp::Fiel...At the moment, we propagate parsing errors pretty random up through the call stack when they occur. I propose that we implement the `std::ops::BitOr` trait, so we can use constructs like this:
```rust
let eas = yield_parse!(Exp::Field, Box::new, self.parse_field_exp(offset));
eas |= yield_parse!(Exp::FunCall, Box::new, self.parse_fun_call(offset));
eas |= yield_parse!(Exp::Ident, self.parse_ident(offset));
eas |= yield_parse!(Exp::Int, self.parse_literal_int(offset));
eas |= yield_parse!(Exp::Char, self.parse_literal_char(offset));
eas |= yield_parse!(Exp::Bool, self.parse_literal_bool(offset));
```
The implementation of BitOr should then return the _first_ occurring error (a.k.a. the error with the smallest `span.start`). This way, we will be able to describe the correct error to the user, instead of just picking one at random, or needing to generate a custom one.Amber Sprenkelsd.sprenkels@cs.ru.nlAmber Sprenkelsd.sprenkels@cs.ru.nl