File: default.txt

package info (click to toggle)
highlight.js 10.7.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,332 kB
  • sloc: javascript: 41,059; makefile: 157; python: 29; sh: 20
file content (49 lines) | stat: -rw-r--r-- 1,194 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * An example of Flix for syntax highlighting.
 */

// Here is a namespace.
namespace a.b.c {

    // Here are some literals.
    def b: Bool = true
    def c: Char = 'a'
    def f: Float = 1.23
    def i: Int = 42
    def s: Str = "string"

    // Here are some relations.
    rel LitStm(r: Str, c: Int)
    rel AddStm(r: Str, x: Str, y: Str)
    rel DivStm(r: Str, x: Str, y: Str)

    // Here is a lattice.
    lat LocalVar(k: Str, v: Constant)

    // Here is an index.
    index LitStm{{r}, {r, c}}

    // Here is an enum.
    enum Constant {
          case Top,

        case Cst(Int),

          case Bot
    }

    // Here is a function.
    def leq(e1: Constant, e2: Constant): Bool = match (e1, e2) with {
        case (Constant.Bot, _)                      => true
        case (Constant.Cst(n1), Constant.Cst(n2))   => n1 == n2
        case (_, Constant.Top)                      => true
        case _                                      => false
    }

    // Here are some rules.
    LocalVar(r, alpha(c)) :- LitStm(r, c).

    LocalVar(r, sum(v1, v2)) :- AddStm(r, x, y),
                                LocalVar(x, v1),
                                LocalVar(y, v2).
}