In order to have a better understanding of context-free grammars, lexers and parsers, I have started to implement a basic JSON editor with @vuejs as an exercice by reading `Compilers, Techniques, & Tools` along the way (http://bit.ly/compilers-principles …) (1/3)
-
-
In the past, I would not dare playing with a recursive descent parser. Thanks to reactivity in a browser brought by modern libraries, the fun is back. Would anyone like me to write a short article on the topic (from BNF to the edition of semantic tokens as
@vuejs components)? 3/3Prikaži ovu nit -
I've published the JSON editor (still pretty much useless so far but all the "work" is now open source and it might still give some insight about what could be done from there) https://json.weaving-the-web.org/#/lexical-analysis/json-parser …
@afanad@Adrien0@jiherr@JonathanBeurel@maxthoon@Florianrival@AzzoutYPrikaži ovu nit -
Along the way, I had my mind totally blown by the
#ANTLR project open sourcing a massive repository of grammars and many fantastic tools wonderfully well-documented and battle-tested for JavaScript in browsers https://github.com/antlr/antlr4/blob/master/doc/javascript-target.md … Thanks you@the_antlr_guy!Prikaži ovu nit -
http://bit.ly/github-compilers … (source repo) isn't only focused on a JSON editor but also on learning abt compilation, that is why the only files related to the editor are those contained in http://bit.ly/antlr-module (mostly generated apart from JSONDrawer.js) andhttp://bit.ly/learning-compilers-json …
Prikaži ovu nit -
@mickael_andrieu I am wondering if you've had a chance to use some of@nikita_ppv libraries dedicated to PHP source code parsing https://github.com/nikic/php-ast or https://github.com/nikic/PHP-Parser … libraries?Prikaži ovu nit -
My original intent was to edit the abstract syntax tree of a PHP source file to remove simple duplications of code / to add guard functions calls / to add calls to the logger in special cases (in exception `catch block for example).
Prikaži ovu nit -
Along the way, I've come to realise how reactive components would help in adding alterations logic to specific tokens depending on their semantic. It could help us to make diffs between semantic tokens instead of plain characters and possibly to help write better atomic commits.
Prikaži ovu nit -
Editing a source code written in a given language would be equivalent to editing a virtual DOM made of specific components (one for each terminal / non-terminal in a given grammar), hence bringing actions for each of the language constructs would not be as difficult as...
Prikaži ovu nit -
...creating additional components. Those components would then be automagically inserted and scoped to their respective tokens thanks to the logic of a recursive descent parser which job is to recognise the expressions and to call semantic actions at the right time.
Prikaži ovu nit -
@Florianrival From the top of your head, would you happen to have heard of alternative virtual DOM implementations with solid documentation (enabling one to diff trees manually)? One could think of React of course, but I'm looking for lighter and (easier? to grasp) alternatives.Prikaži ovu nit -
I've added Copy to clipboard of edited JSON, In-place edition of pair values (as in https://github.com/antlr/grammars-v4/blob/master/json/JSON.g4#L17 …) and some examples https://bitly.com/edit-json ... I'm very worried about
#xss though cc:@msuixo,@YogoshaOfficial,@MadeWithVueJS@paulgregPrikaži ovu nit -
I've used https://github.com/punkave/sanitize-html … to clean the edited values but I can't help myself to believe there should be some ways how to hijack the compilation of manual entries, since edited contents can't be shared, it doesn't matter but I'd like to ship it safely
#sanitizationPrikaži ovu nit
Kraj razgovora
Novi razgovor -
Čini se da učitavanje traje već neko vrijeme.
Twitter je možda preopterećen ili ima kratkotrajnih poteškoća u radu. Pokušajte ponovno ili potražite dodatne informacije u odjeljku Status Twittera.
