Closed mauris closed 5 years ago
Hello Sam @mauris ,
Thank you for the suggestion.
Since I'm not familiar with LPS, could you give me some context:
I can see you feed the library with rules defined in .lps
files, but what is the output?
For example, in the following code, what kind of thing the engine can do?
const LPS = require('lps');
LPS.loadFile('program.lps')
.then((engine) => {
engine.run();
});
How that interpreter can be used inside an existing project, could you give me some examples?
And then how would it be tagged in _Best of JavaScript, could you see a similar project?
Sorry for my very naive questions, thank you for your understanding!
No they are not naive questions and are very valid. Perhaps the quick usage guide at https://lps.js.org/ can explain more on the various ways to use LPS in existing JS implementations.
In particular, the interpreter can be used in the context of web browsers on web pages, to simplify event handling from the UI. Mouse and keyboard events etc. can be modelled as observations for a LPS program, so that reactive rules and logic clauses can be used to handle these events. A DOM library is being implemented as part of lps.js for direct DOM access and manipulation from LPS language.
Instead of loading from files, rules and clauses can also be loaded from a String in JS. The other API that's not shown in the readme is something like:
LPS.loadString('<LPS syntax goes into the string...>')
.then((engine) => {
engine.run();
});
The interpreter has been integrated into LPS Studio as a library to an Electron app.
Actions are special predicates in LPS where it can be chosen to fulfill the consequent of fired reactive rules (rules are in the form: if antecedent then consequent). In lps.js, actions can also be defined from JS, allowing any JS functions to be called from the LPS program.
I hope I've answered some of your questions about lps.js. Feel free to ask more questions. If you feel that the library is not suitable for listing, feel free to close it. I'm just glad to have shared about this to one other person.
Hello Sam, Thank you for the link and for the explanation. It seems the repo is not linked to the correct URL, now it's linked to http://lps.doc.ic.ac.uk/, which does not seem to provide useful information for JS developers.
You said it can be used
to simplify event handling from the UI.
But I can't see any example, I still have no idea about how the code looks like.
Usually frameworks in the JS world show an example of "To Do List" Application... it's the universal "Hello World" of UI frameworks / libraries!
You may know about http://todomvc.com/ or even better https://github.com/gothinkster/realworld
About the tagging, could we consider it's part of our "compilers" since it produces JavaScript from lps
code, like libraries in this category produce JS cod from an other language: https://bestofjs.org/tags/compiler?
Thank you for your help!
Closing the issue because from now, only projects with more than 50 stars are eligible. It may change in the future if we find a way to make the selection process automatic, or if the architecture change to accept a lot more projects. Thank you for your understanding!
lps.js is the LPS interpreter implemented in JS: https://github.com/mauris/lps.js