C tags logic

Can someone help me understand to how exactly C tags parses function names from c files?

Replies

  • Ankita Katdare
    Ankita Katdare
    @#-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?
  • Nikhil Lokhande
    Nikhil Lokhande
    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

    It will list all function names with line_number.

    Please help me out regarding parser logic?
  • sr patil
    sr patil
    @#-Link-Snipped-#, sir please can you tell me what is c tags?
  • Nikhil Lokhande
    Nikhil Lokhande
    sr patil
    @#-Link-Snipped-#, sir please can you tell me what is c tags?
    Ankita already explained ctags meaning ๐Ÿ˜€

    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 ๐Ÿ˜€
  • sr patil
    sr patil
    Thank you sir!
  • Anand Tamariya
    Anand Tamariya
    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.
  • Nikhil Lokhande
    Nikhil Lokhande
    Anand Tamariya
    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.
    Anand thnx alot ๐Ÿ˜€

    will check upon it..

You are reading an archived discussion.

Related Posts

Hi Friends, I have 4+ years of experience in software testing(manual) and now I would like to come out of testing field. I am also not interested in programming/coding. Please...
Is it just me or has the grammar gone down the hill in recent times? I regularly come across people that have a hard time forming simple sentences - these...
We are happy to announce the launch of our new website: https://forbixindia.com We manufacture electronic automation and lighting products. All our products are indigenous designed and manufactured in Bangalore India,...
Hie, i have completed my B.com from annamalai university(distance education). i wanna choose career in IT field. although i have made my mind to become Software developer or tester. but...
how exactly do we calculate plinth area,floor area, carpet area& built up area of a building?