Results 1 to 4 of 4

Thread: Lexical? Simple Compiler for my Project

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    2

    Lexical? Simple Compiler for my Project

    can anyone help me with my School project..since

    My Teacher told me to make a simple basic compiler that has lexical analysis features


    so it means onc you type an expression on a textbox..and verify that line

    it will separate Identifier,operator,assignment operator and number


    so lets say you type sum=a+b

    then on the ListBox it will show

    sum is an identifier
    = is an Assignment Operator
    a is an identifier
    + is an Operator
    b is an identifier


    just like that and if i inputted sum = 1 + 2 then it will show

    sum is an identifier
    = is an Assignment Operator
    1 is a number
    + is an Operator
    2 is a number

    after that on the second listbox it will show

    Sum = 3 (since 1+2 is inputted on the textbox)



    I hope someone could help me and provide the easiest code as possible

  2. #2
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Lexical? Simple Compiler for my Project

    Noone here will do your homework for you. A quick look around the forums will show you that. But if you get started, and then run into problems, you can post your code in the relevant forum and you are pretty much guaranteed help by the many qualified people here.

    BUT DON'T ASK US TO DO YOUR HOMEWORK.

  3. #3
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: Lexical? Simple Compiler for my Project

    Quote Originally Posted by leiza11
    can anyone help me with my School project..since

    My Teacher told me to make a simple basic compiler that has lexical analysis features


    so it means onc you type an expression on a textbox..and verify that line

    it will separate Identifier,operator,assignment operator and number


    so lets say you type sum=a+b

    then on the ListBox it will show

    sum is an identifier
    = is an Assignment Operator
    a is an identifier
    + is an Operator
    b is an identifier


    just like that and if i inputted sum = 1 + 2 then it will show

    sum is an identifier
    = is an Assignment Operator
    1 is a number
    + is an Operator
    2 is a number

    after that on the second listbox it will show

    Sum = 3 (since 1+2 is inputted on the textbox)



    I hope someone could help me and provide the easiest code as possible
    first o must separate the things... how!?! well you can try this way:
    you can do a loop, in these loop you must see the letters(and simbols) is like you have a string and you shearch the words(you can do these by using mid, left and right string functions(or one of them).... for you see the type of a varible(i don't have sure) but use the typename function...
    i hope that i give some lights
    VB6 2D Sprite control

    To live is difficult, but we do it.

  4. #4
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,961

    Re: Lexical? Simple Compiler for my Project

    Quote Originally Posted by leiza11
    can anyone help me with my School project..since

    My Teacher told me to make a simple basic compiler that has lexical analysis features


    so it means onc you type an expression on a textbox..and verify that line

    it will separate Identifier,operator,assignment operator and number


    so lets say you type sum=a+b

    then on the ListBox it will show

    sum is an identifier
    = is an Assignment Operator
    a is an identifier
    + is an Operator
    b is an identifier


    just like that and if i inputted sum = 1 + 2 then it will show

    sum is an identifier
    = is an Assignment Operator
    1 is a number
    + is an Operator
    2 is a number

    after that on the second listbox it will show

    Sum = 3 (since 1+2 is inputted on the textbox)



    I hope someone could help me and provide the easiest code as possible
    you can shearch caracter after caracter(like using left string function, for example)... using these you can separate the things....
    i hope these words give you some lights
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width