Hi!

The Racket Reader and the Racket Expander always return "Error : blabla" 
when you send it a bad Racket source code.
As a consequence, when there is a source code error, DrRacket and the 
Racket LSP cannot provide IDE functionalities like "find references", "info 
on hover", "find definition"...etc.
This is an issue, because 99% of the time one write code, the code is 
incorrect. Other languages (Rust, Typescript/JS, Java, OCaml...etc) rely on 
an incremental parser than can provide a tree even if the source code is 
wrong. Basically it adds an "ERROR" node in the tree, and go on instead of 
stopping everything and returning at the first error.
Currently this compiler issue is blocking the Racket IDE to provide better 
user experience.
For my practical use case of Racket, it is important.

I would like to help working towards that direction.
I see two possible solutions to that:
1) improve the recursive descent parser of the Reader, as well as the 
Expander to make them incremental and fault-tolerant
2) re-writing the parser in something like tree-sitter or Menhir, at the 
cost of having to re-write the Reader/Expander logic (!!!)

Both solutions are daunting tasks.

For solution 1), could you point me to the Racket's recursive descent 
parser source code? What about the Expander ?

For solution 2), I was thinking of writing a tree-sitter grammar for 
racket. However, I can't find a formal description of the grammar, like 
Scheme did here:
https://www.scheme.com/tspl4/grammar.html#APPENDIXFORMALSYNTAX
Of course, the Racket documentation is still quite comprehensive, but it 
would be nice if anyone could tell me if there is such formal document 
somewhere?
Besides, I wonder whether Racket/Scheme could even be described using a 
LR(1) or a GLR grammar? 

Finally, is any work have been started towards this direction?

Totally off-topic, but has anyone ever thought of compiling Racket down to 
OCaml, in order to reuse js_of_ocaml and produce optimized JS code from 
Racket?
I was wondering whether it would be feasible.

Final note: I know all of that is _very_ ambitious!

Kind regards,
Nicolas

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/d77440e3-1876-44e5-b52b-323d5715df66n%40googlegroups.com.

Reply via email to