hi
Iam creating an application(vc++) which supposed to find the similarity between two programs written in c++ (at SYNTAX and SEMANTICS).
in SYNTAX: i used the tokenize method and save it in strings...thats works
but the question is here in the SEMANTICS:
how can i trace the semantics in the two programs...
i couldnt find any thing practical about it....
this is the last step ...:(
so pleease help me with this...
iam stuck at this point for a long time:sad:

Is this homework or workwork?

What is the application?

Semantics is a pretty broad field. In a very small domain, you can track semantics, but if the programs are very disparate in design then you are going to have a pretty tough time.

I suggest you look into lexical analysis. You'll need to build up some carefully constructed trees and apply some pretty sophisticated transformations on them in order to compare them.

Yoinks.

first its a homework..
i divided the program into three parts..header,declaration and body.
for each i found the SYNTAX similarity ...
but not the semantics..
the body of the program is simple uses if ,else, for ,while, do while ..
so i think its a small domain
so what do u think i should do .... its really urgent ...the homework due in next week ( I ran out of time)

University level (350 or above) or Preparatory/High School?

If the latter, you can probably gather some information from the syntactical analysis.

For example, the following two are equivalent:

if (foo) bar();
else baz();

if (!foo) baz();
else bar();

If the former, you'll have to study what I mentioned, or talk with your professor for more direction.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.