thanks for the advice! Marpa is helping me stretch for the first time in years.
John Alvord On Jul 8, 2014 9:39 AM, "Ruslan Shvedov" <ruslan.shve...@gmail.com> wrote: > John, the article isn't actually mine, it's amon > <http://stackoverflow.com/users/1521179/amon>'s to illustrate his answer > to this stackoverflow question > <http://stackoverflow.com/questions/17275748/scripting-read-condition-written-in-words-and-converting-into-c-ternary-opera> > . > > That being said, on a careful reading it looks like the final > transformation is left as an exercise for the assiduous reader. > > On a related note, you may find this implementation (article > <http://jeffreykegler.github.io/Ocean-of-Awareness-blog/individual/2013/03/bnf_to_ast.html>, > code <https://gist.github.com/jeffreykegler/5121769>) of the The > Interpreter Design Pattern from the Design Patterns book useful. It looks > more complete. > > In my experience, building a translator with Marpa::R2 boils down to > developing a parser for the source language and then processing the > abstract syntax tree (AST, ASF stands for abstract syntax forests, which > are useful the case of ambiguous grammars/inputs) by traversing and > transforming in into the AST of the target language, which can then be > serialized to a text in the target language. > > Hope I got your question right; if I didn't, feel free to say so. > > > > > > > > > > > > > On Tue, Jul 8, 2014 at 7:06 PM, John Alvord <johngrahamalv...@gmail.com> > wrote: > >> Ruslan - I truly appreciate your analysis and explication. >> >> With great respect - it seems like the document is only 90% complete, >> since the final steps to produce what the user user wanted >> >> ============================================== >> So I excel sheet I have string like below: >> >> If ((Myvalue.xyz == 1) Or (Frmae_1.signal_1 == 1)) Then a = 1 >> else a = 0; >> >> This I have to convert into: >> >> a = (((Myvalue.xyz == 1) || (Frmae_1.signal_1 == 1))?1:0) >> >> How this can be handled in perl? >> >> =============================================== >> >> was never documented. I certainly do not expect that - or any - level of >> hand holding, but your post does seem to stop short of the goal. >> >> John Alvord >> >> >> >> >> >> On Thu, Jun 26, 2014 at 7:12 AM, Ruslan Shvedov <ruslan.shve...@gmail.com >> > wrote: >> >>> http://longanswers.blogspot.de/2013/06/transforming-syntax.html >>> >>> >>> On Thu, Jun 26, 2014 at 4:43 PM, John Alvord <johngrahamalv...@gmail.com >>> > wrote: >>> >>>> I have been successful enough parsing a mini-language. Now someone >>>> wants me to do a translator from that language to a newer flavor. >>>> >>>> Are there any examples so far... to get a head start from the ASF to >>>> another language? >>>> >>>> John Alvord >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "marpa parser" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to marpa-parser+unsubscr...@googlegroups.com. >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "marpa parser" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to marpa-parser+unsubscr...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "marpa parser" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to marpa-parser+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "marpa parser" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to marpa-parser+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "marpa parser" group. To unsubscribe from this group and stop receiving emails from it, send an email to marpa-parser+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.