-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP Implement REPL mode for Rewrite #42
Conversation
Uses `convert(Term, ex)` rather than `@term` macro as a more direct approach.
Whoa, fantastic! As far as the Few quick questions:
julia> x = 3;
@term> x + y
x + y
@term> $x + y
3 + y
|
I’m not at my computer right now but yes, interpolation works fine iff ReplMaker loads. The reason tests are failing is that I made the REPL mode load when Rewrite starts. To fix that, we have two options.
I’m currently a little stuck with the rule set, but I feels like something I can get pretty quickly, so we’ll see. |
Testing Repl functionality is hard because the test script does not actually spawn a Repl. A new, interactive process needs to be separately invoked (see the Replmaker tests) We can still test it though if you’d like. I know how to do it now (kinda) |
Do you have any preferences for the prompt text / color? Originally, I had the prompt text be Currently, the prompt is blue but that's been causing me some confusion with |
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
==========================================
+ Coverage 98.95% 98.96% +<.01%
==========================================
Files 8 9 +1
Lines 383 386 +3
==========================================
+ Hits 379 382 +3
Misses 4 4
Continue to review full report at Codecov.
|
I like Also, seems like current state is broken ( |
Broken? It says on my end that all 5 checks were successful... Edit: Whoops, I misunderstood, yeah there was a spurious change still in there from my in-development version with rulesets. Should be good now. |
Okay, so now the following syntax is supported:
and
ie. the parser now will separate input based on the Next step is to add tests. |
So I've added some simple tests to just make sure that
is equivalent to
|
Fantastic! The one thing I'm noticing is that it outputs REPL information into the test output (e.g. precompiling, REPL mode initialized, normalized result) - is it possible to slurp that up? Edit: If you wouldn't mind, it would also be great to have the tests in their own |
Yep, no problem it was just a |
Okay that should do it. I see the MacOS builds stalled on 1.0 and 0.7 but not nightly. I had this problem with ReplMaker and couldn't figure out why. It's strange because the tests ran fine on my MacOS Julia 1.0 machine. |
Another problem is that these tests seriously increase the test time because each time I run a test I need to spawn a new julia instance and go through the compilation process for |
Right. I wouldn't consider that a problem with the REPL mode or its tests, though - it's just another reason to fix #38. |
The MacOS build failed on nightly due to REPL output comparison. We should fix that regardless, but any chance that's related to the stalling? |
Since the tests are still not working on MacOS should we maybe only test the repl functionality in Linux for now? |
If I remember correctly, sometimes the MacOS builds would fail for me because the precompilation would screw up the Repl output for travis MacOS. |
Hmm... maybe there's no issue, but the fact that there's no output for so long while rule compilation occurs just terminates builds? ( |
Did Nightly fail on Linux? For me, it shows success... |
Oh, I restarted it after failure, and then it passed. Arbitrary compilation timeout seems even more likely now. |
The problem with this stuff is that IO is inherently non-deterministic. |
Right. Let's see if this helps anything... |
Yeah, again, precompile statements seem to be interfering. I wonder if there's a way to start Julia and tell it not to warn one that is precompiling a stale cache. I could also just disable precompilation for ReplMaker |
I'm refactoring this into a separate package which re-exports Rewrite.jl. It's called RewriteRepl. Still messing around with getting the tests to pass but I think I'm close! I think this PR can be closed. |
Got it; sounds great. Thanks again! :) |
So currently this lets one press
=
at the repl to open a@term>
prompt. This prompt will simply take code one supplies and wrap it with@term
andnormalize
. Hence,@term> 1 + 1
is equivalent tojulia> normalize(@term 1 + 1)
.I am currently working on the next step which is to allow one to declare what set of rules one wants to do with a syntax like
which makes
parse to
This next step can either be tacked onto this PR when it's done, or it can be a separate PR depending on how eager you are to merge this one.
Ref: #27