Language: Racket extension of Scheme
Date: Mar 2023
Repository: github.com/awest25/Code-Difference-Analyzer
The objective of this project is to create a tool that aids in the identification and analysis of similarities between different bodies of code, focusing specifically on the Racket extension of the Scheme programming language. By comparing two sets of Scheme expressions, this solution aims to highlight similarities and differences, providing an easily interpretable summary of the overlaps, aiding in the detection of potential plagiarism or unauthorized copying.
Design a prototype for a Scheme procedure, expr-compare
, that compares two Scheme expressions, x
and y
.
A difference summary in the form of a Scheme expression (a runnable program). If executed where the Scheme variable %
is true, it behaves like x
, and otherwise behaves like y
.
-
To symbolize differences:
- Use
if
expressions and!
in identifiers. - Use
%
for situations wherex
is#t
andy
is#f
. Use(not %)
for the opposite scenario. - For discrepancies between
lambda
andλ
, the summary usesλ
. - In scenarios where
x
uses a bound variableX
andy
usesY
, the summary should represent it asX!Y
.
- Use
-
The prototype should handle a subset of Racket expressions, including:
- Literal constants
- Identifiers
- Function calls
- Special forms like
(quote s- exp)
,(lambda formals expr)
,(λ formals body)
, and(if test-expr expr expr)
.
-
Includes a
test-expr-compare
procedure to validate theexpr-compare
function. -
Two Scheme expressions,
test-expr-x
andtest-expr-y
, to test the output by setting the%
variable.
(expr-compare 12 12) ⇒ 12
(expr-compare #t #f) ⇒ %
(expr-compare '(cons a lambda) '(cons a λ)) ⇒ (cons a (if % lambda λ))
-
expr-compare
: A Scheme procedure that implements the comparison and generation of difference summary. -
test-expr-compare
: A Scheme procedure that tests theexpr-compare
function's output. -
test-expr-x
andtest-expr-y
: Two Scheme variables containing data that exercises the entire specification ofexpr-compare
. -
Any auxiliary definitions that might be required.
- Clone the repository:
git clone github.com/awest25/Code-Difference-Analyzer
- Navigate to the directory:
cd Code-Difference-Analyzer
- Run the program: racket expr-compare.ss
- Use expr-compare as above.