From: Lori Flynn <lori@cse.ucsc.edu>
To: sourcenav@sources.redhat.com
Cc: eraffenne@teleline.es
Subject: hacking the Tcl parser
Date: Mon, 14 Jan 2002 14:02:00 -0000 [thread overview]
Message-ID: <Pine.GSO.4.05.10201111720360.9045-100000@mafalda.cse.ucsc.edu> (raw)
Hi everyone,
I also (like Emmanuel in her Aug.8th 2001 post) am interested in hacking
the Tcl parser so it can parse procedures declared slightly differently.
A colleague has done a lot of work towards this, the details are described
below. (I'm wanting 'instproc' to be recognized just as Tcl's 'proc' as a
keyword which is followed by a function name... OTcl declares methods this
way. ) Right now we can compile snavigator and it will now recognize
variables declared within an instproc as variables (so they turn up when I
use snavigator's filter and ask it to show me all variables). However, the
instproc function/method doesn't show up in the filter.
I imagine the fact that lines with instproc have a word (the class) before
the keyword 'instproc' is part of the problem, with the parsing.
Any ideas, I don't have time to create a whole new parser for OTcl and am
hoping for some clue about how to go about completing this hack...
Thanks in advance for clues!!
Lori
*************************************************
These are the changes so far:
/projects/ccrg/mmosko/code/SN/source/Makefile
Changed top line to lower one:
#all-sid: all-tcl all-tk all-libremote
all-sid: all-tcl all-tk
Makefile.ct
Makefile.ct: (reverse lines 25 & 26)
24 Tree.h Tree.c: tcl.ast
25 cg -cdimRDIO tcl.ast;
26 # ast -cd tcl.ast;
Trafo.c change variable 'To_names' to 'to_names'
tcl.puma change variable 'To_names' to 'to_names'
itcl.puma Added {} around all c code, plus line 12 included sn.h (not
the file paf.h)
tcl.ast Changed includes for path (no 'include' directory and
also name of files is different: Idents.h,StringM.h,
and Position.h),line 45 ' instproc = .', and
iinstproc added line 14 and 25 to list of keywords.
Scanner.c: Add the typecasts to (int)
1051 yyEol ((int)TokenPtr + (int)TokenLength - (int)p - 1);
Lines 16 and 23 include "Position.h" (not Positions.h)
Lines
Parser.c: Where have "yySnyAttribute.fragment.'*'", changed
it to "'*'"
Commented out function "\\ReleaseTreeModule ();"
Wherever had phrase like yySynAttribute.fragment.'$',
changed to just '$' (same with $, }, { , ] )
Line 40 # include "Position.h" (not "Positions.h")
Parser.h:
Added '#include <string.h>'
Added:
# if defined __STDC__ | defined __cplusplus
# define ARGS(parameters) parameters
# else
# define ARGS(parameters) ()
# endif
Parser.lalr:
tcl.pars: Comment out ReleaseTreeModule if the function is still there.
Tree.h: Line 85 add iinstproc to list of keywords
Tree.c:
Lines 12 and 22, change StringMem.h to StringM.h
Lines 15 and 25, change Positions.h to Position.h
Comment out lines 231 - 235
226 tTree Tree_Alloc ()
227 {
228 register yytBlockPtr yyBlockPtr = yyBlockList;
229 register int i;
230
231 //if (yyMaxSize == 0)
232 //for (i = 1; i <= 50; i ++) {
233 //Tree_NodeSize [i] = (Tree_NodeSize [i] + yyMaxAlign - 1) &
yyAlignMasks [yyMaxAlign];
234 //yyMaxSize = Max (Tree_NodeSize [i], yyMaxSize);
235 //}
236
237 yyBlockList = (yytBlockPtr) Alloc (sizeof (yytBlock));
From Emmanuelle's mail August 9 2001:
> I want to modify the Tcl parser
> that it can parse procedures declared that way but I need a
> little help
> to do that; the source code of SN is very large and I don't know from
> where to start.
The TCL parser can be found in:
/source/snavigator/parser/tcl
There is documentation on how to add parsers:
/source/snvavigator/doc/html/enterprise/progref
But the TCL parser does not follow use this API. Do as we say, not as we
do.
It inserts symbols with put_symbol. The TCL parsers uses a
parser-generator
/ compiler-compiler, but it doesn't use yacc/bison. Puma or something. If
you wish to modify the code, you will need this tool.
Happy hacking,
Craig Keogh
next reply other threads:[~2002-01-12 2:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-14 14:02 Lori Flynn [this message]
2002-01-17 18:22 ` Ian Roxborough
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.05.10201111720360.9045-100000@mafalda.cse.ucsc.edu \
--to=lori@cse.ucsc.edu \
--cc=eraffenne@teleline.es \
--cc=sourcenav@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).