Member • Feb 4, 2014
-
Nikhil LokhandeCan someone help me understand to how exactly C tags parses function names from c files?
-
Administrator • Feb 4, 2014
@#-Link-Snipped-# Interesting question.
The ctags programs are used for creating an index file for different language objects found in a file or a number of files. This tag file makes it easy for us to locate these easily and faster using a text editor or other utility.
A "tag" signifies a language object for which an index entry is available. Alternatively, ctags can generate a cross reference file which lists, in human readable form, information about the various source objects found in a set of language files.
Can you share some example so that we can discuss things based on it?Are you sure? This action cannot be undone. -
Member • Feb 5, 2014
Thanks for response 😀
I want to know how it is implemented to create an index?
It is parsing whole C file to find out the function definition while building index file thats what I know...
I didn't go any info regarding what was the parser logic used?
once u install ctags u can manually generate particular index using command
ctags -x <file-name>
It will list all function names with line_number.
Please help me out regarding parser logic?Are you sure? This action cannot be undone. -
Member • Feb 5, 2014
@#-Link-Snipped-#, sir please can you tell me what is c tags?Are you sure? This action cannot be undone. -
Member • Feb 5, 2014
Ankita already explained ctags meaning 😀sr patil@#-Link-Snipped-#, sir please can you tell me what is c tags?
In Nutshell I can say that due to Ctags you can easily browse through code.
e.g.
1 function defined in first.c file
void main()
{
call(a,b);
}
in second.c file u wrote function "call".
When you open file first.c in vim editor and press ctrl+] , you directly goto second.c file on the line where call function is defined.
Again if you press ctrl+T you will come back to first.c file where call function was called.
I just gave example of function.
It is applied to class , macro etc.
It can be used in almost all languages.
You can install ctags utility on your PC and check it out 😀Are you sure? This action cannot be undone. -
Member • Feb 6, 2014
Thank you sir!Are you sure? This action cannot be undone. -
Member • Feb 7, 2014
Do you know about token parsers and Abstract Syntax Trees (AST)? The syntax for functions and variables is well defined. You parse those tokens and decide whether it's a function or variable or logic code.Are you sure? This action cannot be undone. -
Member • Feb 8, 2014
Anand thnx alot 😀Anand TamariyaDo you know about token parsers and Abstract Syntax Trees (AST)? The syntax for functions and variables is well defined. You parse those tokens and decide whether it's a function or variable or logic code.
will check upon it..Are you sure? This action cannot be undone.