Electrofriends

C program for Lexical Analyzer

by Ranjith | March 29th, 2010.

C program for Lexical Analyzer #include<iostream.h> #include<conio.h> #include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> struct pgm { char line[20]; } s[100]; void check(char s[]) { cout<<"\n"; if(!strcmpi(s,"If")) { cout<<"keyword:If"; return; } if(!strcmpi(s,"Then")) { cout<<"keyword:Then"; return; } if(!strcmpi(s,"Else")) { cout<<"keyword:else"; return; } if(!strcmpi(s,"[END]")) { return; } cout<<"expression:"<<s; } void main() { char t[20]; int i=0,j=0,k=0; clrscr(); cout<<"\n\n enter the [...]

Read More..

Sudoku Solver using C++

by Ranjith | November 20th, 2008.
Figure: 1- Sudoku Problem

You have seen it in the news papers, you have seen it in the magazines or in the web sites, you might have sat hours ‘n hours to solve it. Yes, it is the king of all number puzzles, it is “SUDOKU”. We bring to you the ultimate solution for all your struggles, The SUDOKU [...]

Read More..

Lexical Analyzer

by Ranjith | November 20th, 2008.
fig a. Process of lexical analyzer

Lexical analyzer converts stream of input characters into a stream of tokens. The different tokens that our lexical analyzer identifies are as follows: KEYWORDS: int, char, float, double, if, for, while, else, switch, struct, printf, scanf, case, break, return, typedef, void IDENTIFIERS: main, fopen, getch etc NUMBERS: positive and negative integers, positive and negative floating [...]

Read More..

Share and enjoy

    • Digg
    • Facebook
    • Technorati
    • StumbleUpon
    • Twitter
    • Reddit
    • del.icio.us
    • Yahoo! Buzz
Copyright©2009 www.electrofriends.com All Rights Reserved. Powered by Dhyeya