Thread: [tcljava-dev] Parsing Jacl
Brought to you by:
mdejong
From: <vm...@en...> - 2005-03-04 18:28:59
|
Hi, I'm new to both this mailing list as well as Tcl. I'm supposed to parse Jacl in order to convert it to Jython. After much effort, I came across tclparser extension to Tcl. However, I'm not sure if tclparser will be able to parse Jacl as well. Like I said, I'm new to even Tcl. I don't know how it works or how to make even the tclparser work. But, before I start to invest time in learning that, I want to make sure that it serves my purpose .i.e parsing Jacl. Will it parse Jacl inaccurately or will it hang altogether? If tclparser does not do the job, what is the best way to go about parsing Jacl? Is it possible to extend the tclparser to do that? Or, is there a Jacl tool similar to tclparser? Or, is it possible the access the jacl parser (maybe by picking the right fragments of the jacl source code and then building them)? Any ideas would be highly appreciated. Thank you Vishal ---------------------------------------- This mail sent through www.mywaterloo.ca |
From: Mo D. <md...@un...> - 2005-03-04 23:26:25
|
On Fri, 4 Mar 2005 13:28:58 -0500 vm...@en... wrote: > Hi, > > I'm new to both this mailing list as well as Tcl. I'm supposed to parse Jacl > in order to convert it to Jython. After much effort, I came across tclparser > extension to Tcl. However, I'm not sure if tclparser will be able to parse > Jacl as well. Funny you should mention this now, I just started on a project to do something very much the same except that I am going to parse Jacl and write out .java source code. > Like I said, I'm new to even Tcl. I don't know how it works or how to make > even the tclparser work. But, before I start to invest time in learning that, > I want to make sure that it serves my purpose .i.e parsing Jacl. Will it parse > Jacl inaccurately or will it hang altogether? Jacl is Tcl, so the tclparser extension should work with it just fine. I am going to be doing just this sort of thing in my project. > If tclparser does not do the job, what is the best way to go about parsing > Jacl? Is it possible to extend the tclparser to do that? Or, is there a Jacl > tool similar to tclparser? Or, is it possible the access the jacl parser > (maybe by picking the right fragments of the jacl source code and then > building them)? Well, tclparser is a C extension for the C version of Tcl. That is fine in my case, but keep in mind that you will not be able to run tclparser inside Jacl. Jacl does not support C extensions for Tcl. I hope that clears things up. cheers Mo DeJong |
From: Tom P. <tpo...@ny...> - 2005-03-08 04:26:22
|
On Fri, Mar 04, 2005 at 03:26:15PM -0800, Mo DeJong wrote: > Funny you should mention this now, I just started on a project to do something > very much the same except that I am going to parse Jacl and write out .java > source code. Funny you should mention this, * 2. I too started on a similar project, but it's been on the shelf for quite a while. My idea was to write the entire system in Tcl, using 'parsetcl' (http://wiki.tcl.tk/9649), as the main parser, and a modified version of Nsync's (should ring a few bells, eh!) LL(1) parser to parse 'expr' expressions. Then compile the whole thing on the fly using my Hyde package. I had thoughts on generating either Java or C, depending on the actual runtime (using critcl to do the on-the-fly compilation for C). I had also modified Jacl to expose CallFrame and Namespace classes as public. Yeah, I realize that writing the compiler system in Tcl would be slow, but I was planning to write the compiler in a way to allow bootstrapping the compiler itself. I was also planning to impose some limitations on the compiler to avoid the sticky parts of compiling Tcl, such as assuming all builtin commands as immmutable, punting on 'trace', etc. I never got that far to worry about the actual implementation. Good luck, and keep us informed on your progress. -- Tom Poindexter tpo...@ny... http://www.nyx.net/~tpoindex/ |
From: <vm...@en...> - 2005-03-07 20:10:56
|
Thank you Mo DeJong for the reply. It helped a lot. However, I have a small concern. What would happen to the tclparser when, in the process of parsing, it comes across some Jacl constructs which are not found in Tcl (for example, a command to access a Java library)? In that case, we might need to extend the tclparser, right? What are your views regarding this? Thank you. Vishal Quoting Mo DeJong <md...@un...>: > On Fri, 4 Mar 2005 13:28:58 -0500 > vm...@en... wrote: > > > Hi, > > > > I'm new to both this mailing list as well as Tcl. I'm supposed to parse > Jacl > > in order to convert it to Jython. After much effort, I came across > tclparser > > extension to Tcl. However, I'm not sure if tclparser will be able to parse > > > Jacl as well. > > Funny you should mention this now, I just started on a project to do > something > very much the same except that I am going to parse Jacl and write out .java > source code. > > > Like I said, I'm new to even Tcl. I don't know how it works or how to make > > > even the tclparser work. But, before I start to invest time in learning > that, > > I want to make sure that it serves my purpose .i.e parsing Jacl. Will it > parse > > Jacl inaccurately or will it hang altogether? > > Jacl is Tcl, so the tclparser extension should work with it just fine. I am > going > to be doing just this sort of thing in my project. > > > If tclparser does not do the job, what is the best way to go about parsing > > > Jacl? Is it possible to extend the tclparser to do that? Or, is there a > Jacl > > tool similar to tclparser? Or, is it possible the access the jacl parser > > (maybe by picking the right fragments of the jacl source code and then > > building them)? > > Well, tclparser is a C extension for the C version of Tcl. That is fine in > my > case, but keep in mind that you will not be able to run tclparser inside > Jacl. > Jacl does not support C extensions for Tcl. I hope that clears things up. > > cheers > Mo DeJong > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > tcljava-dev mailing list > tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcljava-dev > ---------------------------------------- This mail sent through www.mywaterloo.ca |
From: Mo D. <md...@un...> - 2005-03-07 23:21:09
|
On Mon, 7 Mar 2005 15:10:54 -0500 vm...@en... wrote: > Thank you Mo DeJong for the reply. It helped a lot. However, I have a small > concern. What would happen to the tclparser when, in the process of parsing, > it comes across some Jacl constructs which are not found in Tcl (for example, > a command to access a Java library)? In that case, we might need to extend the > tclparser, right? The Tcl parser parses Tcl syntax. The Tcl commands defined in Tcl are not part of the syntax. So, Jacl commands will be parsed just like any other Tcl commands. cheers Mo DeJong |