CakeML / CakeML/cakeml

Make REPL allow user-defined parsers

Open
#1,314 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Standard ML
Stars
1.2k
Forks
104
Avg merge
2d 21h
Merged PRs (30d)
16

Description

At the moment the CakeML/Candle REPL is user configurable through the following references.

https://github.com/CakeML/cakeml/blob/77cbb88a69527fe7eb542f5aa746cc11f57b21e4/compiler/repl/repl_moduleProgScript.sml#L10-L20

`Repl.readNextString` holds a function that populates `Repl.isEOF : bool ref` and `Repl.nextString : string ref`.

This issue is about:
- changing the type of `Repl.nextString` to `(string + Ast.dec list) ref`
- moving the OCaml parser from the bootstrap translation to the candle boot files

In the new setting, the CakeML/Candle REPL starts by reading the initial input from a boot file written in CakeML concrete syntax. This file can be used to define a new parser, e.g., an OCaml parser. The new parser can then be put to use by updating `Repl.readNextString : (unit -> unit) ref` so that it parses input using the new parser and assigns it to the `Ast.dec list` option of `Repl.nextString`.

Perhaps `Repl.nextString` should be renamed to `Repl.nextInput`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with compiler/repl/repl_moduleProgScript.sml, especially the Repl.readNextString, Repl.isEOF, and Repl.nextString references. Read the Candle boot files and the bootstrap translation to understand where the OCaml parser currently lives. Done means the REPL accepts parser definitions from its initial CakeML boot input and can use the resulting parser through Repl.readNextString.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
cli, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.