summaryrefslogtreecommitdiff
path: root/Blog/Components/Pages/Calc.razor
blob: 295daf6525304c781cbe8d6d924095643143741c (plain)
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
50
51
52
53
54
@page "/Calc"
<PageTitle>Calculator</PageTitle>
<PageScript Src="./Components/Pages/Calc.razor.js"/>

<main>
    <p>A rpn calculator</p>
    <form id="form" class="flex-row">
        <input id="input" type="text" placeholder="1 2 +" />
        <input type="submit" value="Evaluate">
    </form>
    <Log/>

    <fieldset class="docs">
        <legend>Available stack operations</legend>
        <details>
            <summary>dup</summary>
            <p>Duplicates the top value on the stack</p>
            <div class="flex-spread">
                <span>[1, 2, 3]</span>
                <span>dup</span>
            </div>
            <div class="flex-spread">
                <span>[1, 1, 2, 3]</span>
                <span></span>
            </div>
        </details>

        <details>
            <summary>drop</summary>
            <p>Drops the top value on the stack</p>
            <div class="flex-spread">
                <span>[1, 2, 3]</span>
                <span>drop</span>
            </div>
            <div class="flex-spread">
                <span>[2, 3]</span>
                <span></span>
            </div>
        </details>

        <details>
            <summary>swap</summary>
            <p>Swaps the top two values on the stack</p>
            <div class="flex-spread">
                <span>[1, 2, 3]</span>
                <span>swap</span>
            </div>
            <div class="flex-spread">
                <span>[2, 1, 3]</span>
                <span></span>
            </div>
        </details>
    </fieldset>
</main>