l10 /

Filename Size Date modified Message
.settings
examples
regression
sml
src
206 B
105 B
53 B
591 B
2 B
1.2 KB
2.1 KB
565 B
1019 B

L10 Logic Programming Language

This is a source repository for the L10 programming language. Currently, the repository contains a working version of the interpreter, for L10; a compiler to Standard ML and the X10 parallel programming language are in development.

For information on L10 see the preliminary design document, or the examples page.

Running the SML Interpreter (smlten)

The following is an example of loading two different L10 programs in the SML interpreter for L10. For the first example, a standard edge/path example, we run the program to saturation and use PredSet.printSet to print out the entire database. For the second example, a regular expression matcher, we use PredSet.match to selectively query the resulting database of facts.

bash-3.2$ cd l10
bash-3.2$ sml -m sml/smlten.cm   
- Read.file "examples/EdgePath1.l10";
- val db1 = Deduce.deduceStored "db1";
- PredSet.printSet db1;
- Reset.reset ();
- Read.files ["examples/Regexp.l10", 
              "examples/RegexpQuery.l10", 
              "examples/RegexpNot.l10", 
              "examples/RegexpNot2.l10"];
- fun matches db = 
     let 
        open Ast
        open Symbol
     in 
        print "Regexp matches for the full string:\n";
        app (fn x => print (Subst.to_string x ^ "\n")) 
           (PredSet.match (db, Subst.empty,
              (symbol "match", [ Var (SOME (symbol "RE")), 
                                 NatConst 0,
                                 NatConst 3 ])))
      end;
- matches (Deduce.deduceStored "db1");
- matches (Deduce.deduceStored "db2");
- matches (Deduce.deduceStored "db3c");
- matches (Deduce.deduceStored "db4c");
- Reset.reset ();
- Read.files ["examples/ProgAnalysisA.l10", 
              "examples/ProgAnalysisB.l10", 
              "examples/ProgAnalysisC.l10", 
              "examples/ProgAnalysisD.l10", 
              "examples/ProgAnalysisE.l10"];
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.