From d50a0b5b57aae1c7558fa77c362ae2e36038b63c Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Sat, 9 May 2020 16:40:44 +0100 Subject: Add distance function (#75) * Add distance function * Add distance measure for lists with testcases * Add more distance measures for AST * Add distance to commandline * Fix distance always giving 0 --- src/Verismith.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Verismith.hs') diff --git a/src/Verismith.hs b/src/Verismith.hs index c9d3e78..9dc3475 100644 --- a/src/Verismith.hs +++ b/src/Verismith.hs @@ -70,6 +70,7 @@ import Verismith.Tool import Verismith.Tool.Internal import Verismith.Verilog import Verismith.Verilog.Parser (parseSourceInfoFile) +import Verismith.Verilog.Distance import Verismith.Utils (generateByteString) toFP :: String -> FilePath @@ -216,6 +217,11 @@ handleOpts (ConfigOpt c conf r) = do $ T.unpack . toTextIgnore <$> c +handleOpts (DistanceOpt v1 v2) = do + src1 <- parseSourceInfoFile (T.pack v1) (toTextIgnore v1) + src2 <- parseSourceInfoFile (T.pack v2) (toTextIgnore v2) + let d = distance src1 src2 + putStrLn ("Distance: " <> show d) defaultMain :: IO () defaultMain = do -- cgit