From: MSEdit on 7 Jun 2010 04:50 I have recently used taccle + fickle in a project to handle a C like language and have a perfectly working parser. I did not try all the examples but the few I did worked perfectly. As far as i can tell it works almost exactly the same as the lex/yacc that I used several years ago Are you checking that there are no error messages. Unfortunatly the messages are just as cryptic (read identical) to the lex/yacc counterpart. Martyn
From: Uwe Klein on 7 Jun 2010 05:34 MSEdit wrote: > Unfortunatly the messages are just as cryptic (read identical) to the > lex/yacc counterpart. High quality emulation/replication, then? uwe
From: MSEdit on 7 Jun 2010 08:45 On Jun 7, 11:34 am, Uwe Klein <uwe_klein_habertw...(a)t-online.de> wrote: > MSEdit wrote: > > Unfortunatly the messages are just as cryptic (read identical) to the > > lex/yacc counterpart. > > High quality emulation/replication, then? > > uwe Probably more due to the nature of the problem than to the copying of code, the generated code is actually reasonably readable if not very understandable. Martyn
From: tom.rmadilo on 7 Jun 2010 11:45 On Jun 6, 11:35 pm, Uwe Klein <uwe_klein_habertw...(a)t-online.de> wrote: > tom.rmadilo wrote: > > But you still have to solve the problem. Trying to adapt your language > > to Tcl's parser seems like the last thing on the list of things to do. > > But if you get lucky....priceless. > > "priceless" > > would that not move "tcl grammar" to the top of my problem solving > "shift, reduce" mechanism ;-? It is always at the top of mine. Fortunately Tcl mostly has to deal with the serialized output of other programming languages, and this seems to be a point where language designers failed to mess things up so badly that Tcl couldn't easily be, even preferentially used to untangle the remaining mess. Case in point is my template compiler: I could have tried to design a new language, like smarty or php, but why? I had a goal of reducing the features of a regular programming language. Unfortunately providing these features required a compiled language, but I just compiled it back to a Tcl script (This allows an application to accept and execute untrusted templates, you can't do this with any popular template language). And while lex/yacc error messages might be cryptic (do they even exist?), a partially compiled template which is left behind after failure is easy to diagnose to track down syntax errors (because it is formulaic and simple Tcl code!).
From: Fredrik Karlsson on 7 Jun 2010 11:46
Hi all, Sorry, I have been away for a while - thank you for the great input though! Some points for me to adress: * No, yeti does not work for me, and it seems to happen only in Tcl 8.6: frkkan:demo zak$ tclsh8.5 parse-calc.tcl Result is 14 Result is 42 frkkan:demo zak$ tclsh8.6 parse-calc.tcl Segmentation fault frkkan:yeti-0.4.1 zak$ tclsh8.6 yeti.tcl Segmentation fault frkkan:yeti-0.4.1 zak$ tclsh8.6 ylex.tcl Segmentation fault # Trying to just load the files: frkkan:yeti-0.4.1 zak$ tclsh8.5 ylex.tcl frkkan:yeti-0.4.1 zak$ tclsh8.5 yeti.tcl frkkan:yeti-0.4.1 zak$ I am on Mac OS Snow Leopard. The Bus error is now a Segmentation fault, but it seems that the re-installation I did today of Tcl 8.6 did not make a great difference. * Sorry, but no - I am not able to influence the language being parsed, and making commands and just executing them in a safe interpreter is something I considered, but it is impossible I am afraid (or at least, I think it is). The structure of it is more like C-style assignment of variables (X operator Y) rather than "predicate X Y", so it seems tricky to do. * Page - I was refering to the page package in tcllib, which seemed to me to be parser-like. Maybe I was wrong... /Fredrik |