0

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:

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Duoas
0

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.

0

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)

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.