C Language

This is a discussion on C Language within the Tech Board forums, part of the Community Boards category; C Language is a context free or a context sensitive language?...

  1. #1
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    277

    C Language

    C Language is a context free or a context sensitive language?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    It is a context-free language, as far as I can tell from this: http://en.wikipedia.org/wiki/Context-free_language

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    277
    But friend where it is mentioned C Language!!!

  4. #4
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,533
    C is nearly context free. The one exception I can think of is typedef. If typedef precedes a definition the symbol defined becomes a type rather than a variable.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by anirban View Post
    But friend where it is mentioned C Language!!!
    C is not explicitly mentioned, but the description of a "context free language" matches C better than the context sensitive description.

    Whiteflags describes the details.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Anirban Ghosh
    Join Date
    Jan 2006
    Posts
    277
    Okay so what is the final answer?

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by anirban View Post
    Okay so what is the final answer?
    So it's a "nearly context free", meaning that there are exceptions to the context freeness, but the majority of the language is context free. I guess it depends on your rules for where it ends up - is a context-free language that has one or two context-sensitive constructs context-free with exceptions [note that typedef, which is the one context-sensitive construct in C is avoidable - it just makes some things a bit harder to do].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What language did they make Java in?
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 07-03-2005, 04:18 PM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 01:40 PM
  3. assembly language...the best tool for game programming?
    By silk.odyssey in forum Game Programming
    Replies: 50
    Last Post: 06-22-2004, 01:11 PM
  4. Language of choice after C++
    By gandalf_bar in forum A Brief History of Cprogramming.com
    Replies: 47
    Last Post: 06-15-2004, 01:20 AM
  5. Language Script..
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 03-30-2003, 05:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21