Write about REPL module and demo program in development log
This commit is contained in:
1 parent
2011f132f7
commit
df28276496
1 file changed
+14
@@ -129,3 +129,17 @@ serialisations.
|
||||
The printing logic could then be packaged up in an implementation of
|
||||
the Rust standard library's `Display` trait, which is for types that
|
||||
have a textual representation.
|
||||
|
||||
## REPL
|
||||
|
||||
At this point, with the reading and printing implemented, it made
|
||||
sense to create the REPL logic and demo binary so that a full flow
|
||||
through the program could be demonstrated. I first created an
|
||||
`Evaluator` trait to capture the future behaviour of the evaluator,
|
||||
and then wrote a generic REPL module that's able to work with any
|
||||
expression type implementing the `FromStr` and `Display` traits.
|
||||
|
||||
I was then able to create a demo program by defining a dummy evaluator
|
||||
that simply returns the input expression unmodified, and running a
|
||||
REPL using that, connected to stdin and stdout. This demonstrated a
|
||||
full round trip through the parsing and printing procedures.
|
||||
Reference in new issue
Block a user