Skip to content

Make REPL allow user-defined parsers #1314

@myreen

Description

@myreen

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

This Repl module defines some references:
- Repl.isEOF : bool ref
-- true means that all user input has been read (e.g. if we have
reached the end of stdin)
- Repl.nextString : string ref
-- contains the next user input (if isEOF is false)
- Repl.readNextString : (unit -> unit) ref
-- the function that the Repl uses to read user input; it is this
function that assigns new values to Repl.isEOF and Repl.nextString
- Repl.exn : exn
-- the most recent exception to propagate to the top

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions