Thread: scanner / parser (Source Cose) !!

  1. #1
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70

    scanner / parser (Source Cose) !!

    hi guy`s ,

    can someone tell me where can i find the scanner and parser source codes ?!!

    scanner (take a character and convert it to tokens)

    parser (take the tokens and convert it to parse tree)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You'll find it all in the header described in this post. Instead of using disk, you'll need to subsitute scanner and parser.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70
    no that`s not what i mean !

    i mean like this : http://www.mattababy.org/~belmonte/T.../CCC/scanner.c

    but i need a full scanner.c that recognize if/else/while/void/int/return that`s enough ..

    and i couldn`t find the parser !! can someone help me to find it source code ?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    > can someone help me to find it source code ?
    I looked underneath my chair - nothing.

    Have you considered actually trying to do the work yourself rather than merely competing with your class-mates to see who has the best google skills.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    GNU Bison and Flex. Probably more than you need*. Good luck.

    Heh, magic scanner/parser. Which reminds me...
    Attachment 7010


    * And probably more than he can handle, too.
    Last edited by jafet; 11-17-2006 at 06:57 AM.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  6. #6
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70
    i want to learn and read the code , this things have no related with what you talking about Salem ..

    and about the way i am a medical student not a computer science student ??!!!

  7. #7
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    Quote Originally Posted by Meshal
    and about the way i am a medical student not a computer science student ??!!!
    quite interesting.

    Why do medical student need a parser which parses a code

    ssharish2005

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Yeah, like we haven't heard the "But I need one to compare with the one I've written" before.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70
    i am interesting in computers espescially in programming and i like to learn C and be a prof. on it , and i want to know how scanner / parser be programmed !!

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So start with the basics and work your way up like everyone else.

    Sure, you might find a scanner which does what you want, but how would you know whether it was "good C" to learn from?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  11. #11
    C 1337 Meshal's Avatar
    Join Date
    Nov 2006
    Posts
    70
    thanks for your advice

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  2. Open Source Licenses
    By Mario F. in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 10-10-2006, 08:53 PM
  3. Problem with a file parser.
    By Hulag in forum C++ Programming
    Replies: 7
    Last Post: 03-17-2005, 09:54 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. My first Scanner (real Open Source)
    By Lynux-Penguin in forum Linux Programming
    Replies: 0
    Last Post: 04-30-2002, 12:12 AM