about summary refs log tree commit diff stats
path: root/subx/apps/pack
Commit message (Expand)AuthorAgeFilesLines
* start of new syntax for segment headersKartik Agaram2019-05-171-0/+0
* 5180Kartik Agaram2019-05-161-0/+0
* complete the skeleton of dquotes.subxKartik Agaram2019-05-151-0/+0
* Merge branch 'dquotes' into dquotes-1Kartik Agaram2019-05-131-0/+0
|\
| * start using the new carry flagKartik Agaram2019-05-131-0/+0
| * 5156 - error-checking on writes to fileKartik Agaram2019-05-111-0/+0
| * 5154Kartik Agaram2019-05-111-0/+0
| * 5153Kartik Agaram2019-05-111-0/+0
* | Merge branch 'master' into dquotes-1Kartik Agaram2019-05-101-0/+0
|\|
| * 5151 - use mmap everywhere we need a heapKartik Agaram2019-05-101-0/+0
| * 5145Kartik Agaram2019-05-041-0/+0
| * 5135Kartik Agaram2019-05-041-0/+0
* | new primitives: append-byte, append-byte-hexKartik Agaram2019-05-021-0/+0
* | standardize function namesKartik Agaram2019-05-021-0/+0
|/
* 5118 - convert int to stringKartik Agaram2019-04-231-0/+0
* 5105Kartik Agaram2019-04-161-0/+0
* 5092Kartik Agaram2019-04-151-0/+0
* 5090Kartik Agaram2019-04-131-0/+0
* 5074Kartik Agaram2019-04-101-0/+0
* 5060Kartik Agaram2019-04-061-0/+0
* 5059Kartik Agaram2019-04-051-0/+0
* 5058Kartik Agaram2019-04-051-0/+0
* 5056Kartik Agaram2019-04-051-0/+0
* 5054Kartik Agaram2019-04-031-0/+0
* 5053Kartik Agaram2019-04-031-0/+0
* 5052Kartik Agaram2019-04-021-0/+0
* 5051 - done compiling SIB operandsKartik Agaram2019-04-021-0/+0
* 5050 - compile ModR/M operandsKartik Agaram2019-04-021-0/+0
* 5046Kartik Agaram2019-04-011-0/+0
* 5044Kartik Agaram2019-04-011-0/+0
* 5042Kartik Agaram2019-03-311-0/+0
* 5041 - compile displacement operandsKartik Agaram2019-03-311-0/+0
* 5040 - compile immediate operandsKartik Agaram2019-03-301-0/+0
* 5039 - compile opcodesKartik Agaram2019-03-301-0/+0
* 5038Kartik Agaram2019-03-291-0/+0
* 5036Kartik Agaram2019-03-291-0/+0
* 5034Kartik Agaram2019-03-291-0/+0
* 5027Kartik Agaram2019-03-271-0/+0
* 5023Kartik Agaram2019-03-261-0/+0
* 5021 - done packing data segment?Kartik Agaram2019-03-231-0/+0
* 5020Kartik Agaram2019-03-231-0/+0
* 5019Kartik Agaram2019-03-231-0/+0
* 5018Kartik Agaram2019-03-231-0/+0
* 5017Kartik Agaram2019-03-221-0/+0
* 5014Kartik Agaram2019-03-211-0/+0
* 5013Kartik Agaram2019-03-201-0/+0
* 5012Kartik Agaram2019-03-201-0/+0
* 4999Kartik Agaram2019-03-101-0/+0
* 4996 - back on pack.subxKartik Agaram2019-03-081-0/+0
* 4988Kartik Agaram2019-02-251-0/+0
55 } /* 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 */
# example program: constructing functions out of order
#
# We construct a factorial function with separate base and recursive cases.
# Compare factorial.mu.
#
# This isn't a very tasteful example, just a simple demonstration of
# possibilities.

def factorial n:num -> result:num [
  local-scope
  load-ingredients
  {
    <base-case>
  }
  <recursive-case>
]

after <base-case> [
  # if n=0 return 1
  zero?:bool <- equal n, 0
  break-unless zero?
  return 1
]

after <recursive-case> [
  # return n * factorial(n - 1)
  x:num <- subtract n, 1
  subresult:num <- factorial x
  result <- multiply subresult, n
]

def main [
  1:num <- factorial 5
  # trailing space in next line is to help with syntax highlighting
  $print [result: ], 1:num, [ 
]
]