SayPro The Read-Execute-Print Loop (REPL)

REPL is the 1-2-3 kicked up a notch. Here the program doesn’t halt after printing its output, it just goes back and asks for more input. Command-line interfaces are REPLs, and most interpreted programming languages come with a REPL wrapped around the interpreter. But if you give the REPL the ability to maintain state between each command then you have a powerful base to build simple software that can do complex things. You don’t even need to implement a full programming language, just a simple "KEYWORD {PARAMETER}" syntax can still be effective for a lot of applications.The design of a REPL program should keep the session’s state separate from the code that interprets commands, and the interpreter should be agnostic to the fact that it’s embedded in a REPL so that you can reuse it in other patterns. If you’re using OOP then you should also create an Interface to abstract the output classes with, so that you aren’t writing to STDOUT directly but to something like myDevice.Write(results). This is so you can easily adapt the program to work on terminals, GUIs, web interfaces and so-on.Please visit our website at www.saypro.online Email: info@sayro.online Call: + 27 (0) 11 071 1903 Email: info@saypro.online Tel: + 27 11 071 1903 WhatsApp: + 27 84 313 7407. Comment below for any questions and feedback. For SayPro Courses, SayPro Jobs, SayPro Community Development, SayPro Products, SayPro Services, SayPro Consulting, and SayPro Advisory visit our website to www.saypro.online


Comments

Leave a Reply