static void Main(string[] args)
        {
            MyFileParser    myFileParser    = new MyFileParser();                                                          //instantiate my file parser
            Radar           challengeRadar  = new Radar(myFileParser.parseFile(args[0]), myFileParser.parseFile(args[1])); //parse files and generate the appropriate sensors in the radar.
            RadarComparator resultGenerator = new RadarComparator();                                                       //Compare the data and generate the requested result of <ID sensor 1 : ID sensor 2>

            resultGenerator.compareSensors(challengeRadar);
            myFileParser.outputToFile(resultGenerator.result);              // Output the result to a  text file
        }
Beispiel #2
0
        private void ConvertErrorModel(StringBuilder m) {
            if (Parent.options.Solver == SolverKind.Z3) {
                // Datatype declarations are not returned by Z3, so parse common
                // instead. This is not very efficient, but currently not an issue,
                // as this not the normal way of interfacing with Z3.
                var ms = new MemoryStream(Encoding.ASCII.GetBytes(Parent.common.ToString()));
                var sr = new StreamReader(ms);
                SExpr.Parser p = new MyFileParser(sr, null);
                var sexprs = p.ParseSExprs(false);
                foreach (var e in sexprs) {
                    switch (e.Name) {
                    case "declare-datatypes":
                        ExtractDataType(e);
                        break;
                    }
                }
            }

            while (ErrorModelTodo.Count > 0) {
                var e = ErrorModelTodo[0];
                ErrorModelTodo.RemoveAt(0);

                switch (e.Name) {
                case "define-fun":
                    ConstructDefine(e, m);
                    break;
                case "declare-sort":
                    SortSet[e[0].Name] = System.Convert.ToInt32(e[1].Name);
                    break;
                case "declare-datatypes":
                    ExtractDataType(e);
                    break;
                case "declare-fun":
                    if (e[1].Name != "" || e[1].ArgCount > 0 || e[2].ArgCount > 0 ||
                        e[2].Name == "Bool" || e[2].Name == "Int") {
                        Parent.HandleProverError("Unexpected top level model element: " + e.Name);
                        throw new BadExprFromProver ();
                    }
                    Functions[e[0].Name] = e[2];
                    break;
                case "forall":
                    // ignore
                    break;
                default:
                    Parent.HandleProverError("Unexpected top level model element: " + e.Name);
                    throw new BadExprFromProver ();
                }
            }
        }
Beispiel #3
0
    void ReadConjectures(string filename)
    {
        try
        {
            System.IO.StreamReader sr = new StreamReader(filename + ".tmp");
            SExpr.Parser p = new MyFileParser(sr, this);
            var sexps = p.ParseSExprs(false);
            Dictionary<string, RPFP.Node> pmap = GetNodeMap();
            foreach (var e in sexps)
            {
                string pname;
                RPFP.Transformer annot;
                GetDefun(e, out pname, out annot);

                if (pmap.ContainsKey(pname))
                {
                    var c = new RPFP.Conjecture();
                    c.node = pmap[pname];
                    c.bound = annot;
                    rpfp.conjectures.Add(c);
                }
                else if (pname[0] != '@')
                { // if not an internal symbol
                    HandleProverError("Prover error: got unknown predicate:" + pname);
                    throw new BadExprFromProver();
                }
            }
            sr.Close();
        }
        catch (Exception)
        {
            HandleProverError("No conjecture file from prover");
            throw new BadExprFromProver();
        }
    }