Jump to content

compiler design

Featured Replies

hi mates

i have project in compiler design especialy lexical analysis so i need help 4 u

 

A C++ program which takes sequence of characters then gives me sequence of their token types.

 

example.

 

if. ............ keyword

3 int value

x,,,,,,,,,,,,, variable

=.............. equal sign

 

this is an example

i neeed more wich help me creating complete compiler

What you're trying to achieve is pretty complicated. What will be the input?

Is the goal here to write your own FSA from scratch, or are you allowed to use existing lexer generators like flex?

Do you mean input

 

int n = 3;

if (n == 3)

{

n++;

}

 

and the following is output?

 

int, keyword

n, variable integer

=, keyword

3, literal integer

if, keyword

(, open bracket type 1

n, variable int n

==, keyword

3, literal int 3

), close bracket type 1

{, open bracket type 2

n, variable int n

++, keyword

}, close bracket type 2

 

or more like this?

 

int, keyword

.=, keyword

..n, variable integer

..3, literal integer

;, keyword

if, keyword

(), bracket set type 1

.==, keyword

..n, variable int n

..3, literal int 3

{}, bracket set type 2

.++, keyword

..n, variable int n

;, keyword

  • 1 month later...

Hi friend,

I can't explain the whole procedure in this post.It's very difficult for me.I have the source code but i can't post it because it's very long.

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.