Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: rough start of an axml compiler

by Logicus
on Jul 21, 2011 at 10:15 UTC ( #915823=note: print w/ replies, xml ) Need Help??


in reply to rough start of an axml compiler

The thing I don't like about this sort of approach, even if it was done with a lovely modern H.O.P lexer or whatever, is that it fundamentally breaks several of my plugins which exploit the runtime parsing engine to do cool things like the refas.

I really can't be bothered carrying on with this, you can moan about how wasteful of processor time my method is all you want, and how it can't be streamparsed, and how its a non-context-grammar-free-lispish-whatever... it doesn't detract from the coolness of aXML and how quick and easy it is to make complex sites with. I just can't be bothered trying to shave a few more clock ticks from the parser or write a compiler which breaks the way it works especially when the database connection even using Apache::DBI configured in the httpd.conf file takes far more processor time up than the parsing.

Bottom line is that this system is not that slow, it can do 30 requests a second running from a 5 year old 1.8ghz laptop, apache2 can use multi-cores, and I am confident that moores law will continue unabated for at least another 20 years so all in all I think my time would be better spent writing cool new plugins and deploying new sites with the existing parsing system that works more or less exactly as it did way back in 2007.

aXML and my parser are completely free for anyone to download and use for whatever they want to use it for and has been available, almost completely unnoticed, right here on perlmonks for the last 4 years.

If anyone feels like packaging it up for putting on CPAN then go right ahead, I have more interesting things to be doing :)


Comment on Re: rough start of an axml compiler
Re^2: rough start of an axml compiler
by ikegami (Pope) on Jul 21, 2011 at 19:57 UTC

    is that it fundamentally breaks several of my plugins

    Plugins shouldn't change the syntax of the language, just the functionality.

    If you follow that principle, the parser is completely independent of the plugins and therefore cannot break them.

    If you don't follow that principle, you're in for a world of hurt.

    Update: "don't" was missing in last sentence.

      Traditionally that is true, but aXML is not traditional!

      Consider this :

      (refas tag="user")/path/to/userfile.xml(/refas) <table> <tr> <td>username : <user>username</user></td> <td>first name : <user>first_name</user></td> <td>surname : <user>sur_name</user></td> </tr> </table>

      The refas (short for refer as) plugin builds a new plugin on the fly called "user", which extracts values from the XML file and substitutes them in the document wherever the tag exists.

      The compiler would split the document up like this :

      print axml(qq@(refas tag="user")/path/to/userfile.xml(/refas)@); print qq@ <table> <tr> <td>username : <user>username</user></td> <td>first name : <user>first_name</user></td> <td>surname : <user>sur_name</user></td> </tr> </table> @;

      Bang! refas doesn't work anymore! The compiler doesn't know what a <user> tag is and ignores it alongside things like <table> and <tr>, and the <refas> tag doesn't have an output other than to modify the parser runtime variables to understand what a <user> tag is.

      The code which would work under a compiler would have to look something like this :

      (refas path="/path/to/userfile.xml") <table> <tr> <td>username : <d>username</d></td> <td>first name : <d>first_name</d></td> <td>surname : <d>sur_name</d></td> </tr> </table> (/refas)

      But that is not necessarily the best way to lay the code out from an design perspective, especially if one of the <user> tags needed to be elsewhere in the document. Also the refas plugin would then also have to take input data to be modified and give an ouput, or you would have to scrap the refas tag and create a plugin called user. Thus the very act of compilation is placing constraints on the code which I designed the parser over successive code iterations to overcome/eliminate.

        It has nothing to do with tradition. It *does* apply to aXML. Nothing you said is even remotely related to what I said.

        I shall add that you have a fundamental misunderstanding as to the purpose of a parser. Parsers don't produce print statements, they assign meaning to tokens.

Re^2: rough start of an axml compiler
by dreadpiratepeter (Priest) on Jul 22, 2011 at 03:29 UTC

    I really don't understand what you are trying to accomplish at PerlMonks. You came here with your templating system saying it is the greatest thing in the world but it is coded poorly and it is too slow and how can it be fixed.

    You got dozens of responses with good, solid ideas on how to fix the issues and make it faster. Ideas which you ignored and argued against without taking the time to understand them.

    Now you are saying that there was nothing wrong with the code in the first place and that it was always fast enough. And you go on below to say that all the people who know how to write efficient code to solve your problem are chained to antiquated ideas, that aren't needed for your "magic" solution.

    And to top it all off, your final word is that your system is the best thing ever, but it is someone else's job to put it on CPAN.

    So what have you actually accomplished here other than to annoy people, make them waste their time trying to help you (and belittle them with profanity and insults when they do try to help), and fill up the worst nodes lists? You certainly haven't learned anything, not have you contributed in any way. I just hope that the "more interesting things" you are going to do will be done elsewhere. I for one won't miss you and I doubt anyone else will either



    -pete
    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."

      Arghhhhh!!!!!!



      I really don't understand what you are trying to accomplish at PerlMonks. You came here with your templating system saying it is the greatest thing in the world but it is coded poorly and it is too slow and how can it be fixed.

      I've said this lots of times, it's not a templating system, its an abstraction method which can be used to build a templating system within which the programmer is completely free to define their own syntax unlike existing templating system where definitions are set in stone. As a result there is only one language involved, Perl, instead of things like TT2 which are one language sandwiched ontop of another language.

      What I am trying to accomplish is the sharing of a very neat abstraction system which I have found to bring huge savings of time and effort in everyday work.



      You got dozens of responses with good, solid ideas on how to fix the issues and make it faster. Ideas which you ignored and argued against without taking the time to understand them.

      I didn't ignore them, I do understand them I just don't agree that they are applicable/suitable, and or I feel they place too many constraints on what is currently a highly dynamic and totally flexible system.



      Now you are saying that there was nothing wrong with the code in the first place and that it was always fast enough.

      Fast enough is a function of how big your server budget is and the current state of hardware availability. In 2007 when I first came here looking for information on how to improve the processing speed, the efficiency problem was much greater than it is now, and much greater than it will be 4 or 8 years from now.



      And you go on below to say that all the people who know how to write efficient code to solve your problem are chained to antiquated ideas, that aren't needed for your "magic" solution.

      Sorry! not sorry... I admit my solution is not as efficient as it could be, however I have yet to come across a solution to that problem and I have looked!



      And to top it all off, your final word is that your system is the best thing ever, but it is someone else's job to put it on CPAN.

      It is pretty awesome, as you would know if you actually understood what it does. As for CPAN, there is no advantage whatsoever to me personally from bundling it up on CPAN because I already have it installed on all my systems. Putting it on CPAN will only help make it easier to share with others, and if no one wants it then why would I bother?



      So what have you actually accomplished here other than to annoy people, make them waste their time trying to help you

      People need annoying from time to time, keeps them on their toes.



      (and belittle them with profanity and insults when they do try to help),

      If you can link to any profanity I have uttered, you will also find in direct one to one correspondance the rude monk who provoked it as an equal and opposite reaction. I don't start arguments, but I do give as good as I get.



      and fill up the worst nodes lists? You certainly haven't learned anything, not have you contributed in any way.

      I've learnt a few things. aXML is my contribution, just because you don't know what it is or why I want to contribute it doesn't mean it has no value.



      I just hope that the "more interesting things" you are going to do will be done elsewhere. I for one won't miss you and I doubt anyone else will either

      Love you too.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://915823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (17)
As of 2014-07-31 16:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls