about summary refs log tree commit diff stats
path: root/apps/sigils.subx
Commit message (Expand)AuthorAgeFilesLines
* 6595Kartik Agaram2020-06-291-26/+26
* 6507 - use syscall names everywhereKartik Agaram2020-06-101-18/+9
* all syntax sugar now workingKartik Agaram2020-05-181-12/+36
* 6089Kartik Agaram2020-03-061-8/+8
* 5924Kartik Agaram2020-01-271-24/+24
* 5897 - rename comparison instructionsKartik Agaram2020-01-161-48/+48
* 5883 - drop the `ref` keywordKartik Agaram2020-01-121-12/+12
* 5876 - address -> addrKartik Agaram2020-01-031-10/+10
* 5804Kartik Agaram2019-12-081-23/+24
* 5790Kartik Agaram2019-12-051-62/+62
* 5752Kartik Agaram2019-11-181-16/+0
* 5715Kartik Agaram2019-10-261-2/+2
* 5714Kartik Agaram2019-10-251-128/+62
* 5700Kartik Agaram2019-10-171-1/+1
* 5698Kartik Agaram2019-10-151-109/+109
* 5678Kartik Agaram2019-09-191-82/+82
* 5675 - move helpers from subx-common into layersKartik Agaram2019-09-191-1/+1
* 5668 - start reorg to permit syntax sugar in layersKartik Agaram2019-09-191-5/+5
* 5661Kartik Agaram2019-09-151-1/+1
* 5625Kartik Agaram2019-09-051-5/+5
* 5620Kartik Agaram2019-09-041-6/+5
* 5616Kartik Agaram2019-09-041-327/+0
* 5613Kartik Agaram2019-09-031-17/+33
* 5607Kartik Agaram2019-09-011-2/+2
* 5606Kartik Agaram2019-09-011-0/+2
* 5605 - sigils: support *disp32Kartik Agaram2019-09-011-4/+241
* 5604Kartik Agaram2019-09-011-7/+7
* 5603Kartik Agaram2019-09-011-12/+12
* 5602Kartik Agaram2019-09-011-66/+75
* 5601Kartik Agaram2019-08-311-68/+68
* 5600Kartik Agaram2019-08-311-9/+11
* 5599 - sigils: support metadata in %reg and *regKartik Agaram2019-08-311-3/+176
* 5595 - support ebp and esp in sigilsKartik Agaram2019-08-311-0/+173
* 5594 - rename 'desugar' to 'sigils'Kartik Agaram2019-08-311-0/+4439
d.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# accept a filename on the commandline, read it and print it out to screen
# only ascii right now, just like the rest of Mu
#
# To run:
#   $ ./translate_mu apps/print-file.mu
#   $ echo abc > x
#   $ ./a.elf x
#   abc

fn main _args: (addr array addr array byte) -> exit-status/ebx: int {
  var args/eax: (addr array addr array byte) <- copy _args
$main-body: {
    var n/ecx: int <- length args
    compare n, 1
    {
      break-if->
      print-string 0, "usage: cat <filename>\n"
      break $main-body
    }
    {
      break-if-<=
      var filename/edx: (addr addr array byte) <- index args 1
      var in: (handle buffered-file)
      {
        var addr-in/eax: (addr handle buffered-file) <- address in
        open *filename, 0, addr-in
      }
      var _in-addr/eax: (addr buffered-file) <- lookup in
      var in-addr/ecx: (addr buffered-file) <- copy _in-addr
      {
        var c/eax: byte <- read-byte-buffered in-addr
        compare c, 0xffffffff  # EOF marker
        break-if-=
        var g/eax: grapheme <- copy c
        print-grapheme 0, g
        loop
      }
    }
  }
  exit-status <- copy 0
}