Hi Silvio, About this parsing subject maybe looking at BeniBela Xidel and InternetTools help you or talking to Benito Aurthur of them. He is a very good developer and kind person like you. http://videlibri.sourceforge.net/xidel.html http://www.benibela.de/sources_en.html#internettools
Ara On Fri, Mar 6, 2015, at 10:15 AM, Kostas Michalopoulos wrote: > This is a classic series of articles that show how to write a very > simple compiler in Turbo Pascal. The fundamentals when it comes to > scanning are the same: > > http://compilers.iecc.com/crenshaw/ > > I've also written a BASIC implementation for Free Pascal and Lazarus. > The scanner should be straightforward to understand: > > http://runtimelegend.com/rep/rbasic/artifact/2350e85c36a77e4d2d76adde23fd7d45731b5b22 > > The compiler code shows how it can be used: > http://runtimelegend.com/rep/rbasic/artifact/93859f52fd424edfc1e0d5dfd16a92ed8ac04855 > > But you may also find the formatter code simpler. Although it is a bit > too simple: > http://runtimelegend.com/rep/rbasic/artifact/f3e9fb2d1ed8e60d36b50754c2d9a7d7c109fc40 > > For general theory you can look on recursive descent parsers (they're > the simplest to implement and AFAIK most compilers use them, either to > build the token list or directly). > > > On Fri, Mar 6, 2015 at 6:55 PM, silvioprog > <silviop...@gmail.com> wrote: >> Hello, >> >> I'm planning to write three parsers, and googling, I found some >> entries talking about lexical parsers. >> >> After that, I did a 'find in files' in FPC sources, and I found many >> parsers (eg: jsonparser (jsonscanner), JSParser (JSScanner), >> fpsqlparser (fpsqlscanner), PParser (PScanner), fpexprpars etc.) that >> use lexical scanner. >> >> Below, three possible string that I need to parse: >> >> 1) >> >> ${someVariable} -- 4 tokens >> >> or >> >> ${a + b} -- 8 tokens - 1 expression >> >> or >> >> ${fn:lenght('abc') * 3} -- 11 tokens - 1 function - 1 expression >> >> 2) >> >> <c:forEach var="contact" items="${contactDao.list}"> ${contato.name}, >> ${contato.email} </c:forEach> >> >> 3) >> >> contacts[0].name=abc contacts[0].email=abc@def contacts[1].name=def >> contacts[2].email=def@ghi >> >> So my parser will allow to register dynamic variables, functions (to >> be called via script) and plugins (to extend the parser). >> >> However, I have a question: is there any article about 'how to write >> lexical parsers' using Object Pascal? >> >> I need any material about this subject, and I'm very grateful for >> any tip. >> >> Thanks in advance! >> >> >> -- >> >> Silvio Clécio My public projects - github.com/silvioprog >> >> >> -- >> _______________________________________________ >> Lazarus mailing list Lazarus@lists.lazarus.freepascal.org >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> > > -- > _________________________________________________ > Lazarus mailing list Lazarus@lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- http://www.fastmail.com - The professional email service
-- _______________________________________________ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus