File: default.expect.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-- 2,950 bytes parent folder | download
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
<span class="hljs-comment">/**
 * An example of Flix for syntax highlighting.
 */</span>

<span class="hljs-comment">// Here is a namespace.</span>
<span class="hljs-keyword">namespace</span> a.b.c {

    <span class="hljs-comment">// Here are some literals.</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">b</span></span>: Bool = <span class="hljs-literal">true</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">c</span></span>: Char = <span class="hljs-string">&#x27;a&#x27;</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">f</span></span>: Float = <span class="hljs-number">1.23</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">i</span></span>: Int = <span class="hljs-number">42</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">s</span></span>: Str = <span class="hljs-string">&quot;string&quot;</span>

    <span class="hljs-comment">// Here are some relations.</span>
    <span class="hljs-keyword">rel</span> LitStm(r: Str, c: Int)
    <span class="hljs-keyword">rel</span> AddStm(r: Str, x: Str, y: Str)
    <span class="hljs-keyword">rel</span> DivStm(r: Str, x: Str, y: Str)

    <span class="hljs-comment">// Here is a lattice.</span>
    <span class="hljs-keyword">lat</span> LocalVar(k: Str, v: Constant)

    <span class="hljs-comment">// Here is an index.</span>
    <span class="hljs-keyword">index</span> LitStm{{r}, {r, c}}

    <span class="hljs-comment">// Here is an enum.</span>
    <span class="hljs-keyword">enum</span> Constant {
          <span class="hljs-keyword">case</span> Top,

        <span class="hljs-keyword">case</span> Cst(Int),

          <span class="hljs-keyword">case</span> Bot
    }

    <span class="hljs-comment">// Here is a function.</span>
    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">leq</span></span>(e1: Constant, e2: Constant): Bool = <span class="hljs-keyword">match</span> (e1, e2) <span class="hljs-keyword">with</span> {
        <span class="hljs-keyword">case</span> (Constant.Bot, _)                      =&gt; <span class="hljs-literal">true</span>
        <span class="hljs-keyword">case</span> (Constant.Cst(n1), Constant.Cst(n2))   =&gt; n1 == n2
        <span class="hljs-keyword">case</span> (_, Constant.Top)                      =&gt; <span class="hljs-literal">true</span>
        <span class="hljs-keyword">case</span> _                                      =&gt; <span class="hljs-literal">false</span>
    }

    <span class="hljs-comment">// Here are some rules.</span>
    LocalVar(r, alpha(c)) :- LitStm(r, c).

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