gdritter repos virgil / master examples / Basic.vgl
master

Tree @master (Download .tar.gz)

Basic.vgl @masterraw · history · blame

{

  # comments start with an octothorpe
  # objects are created with key-value pairs separated
  # by commas

  "one": 1,    # integers

  "two": 2.0,  # floats

  "three": [ # lists use square brackets
      "s", # the string syntax is identical to JSON's
	  "s",
	  "0", # trailing commas ARE allowed
  ],

  "four": # stitched expressions are fully contained in parens
    ( 2 + 2 ),

  # the with keyword introduces a binding, of the form
  # with [ident] [arg1 arg2 ... argn] = [expr];
  # these can occur anywhere and are ignored, but are scoped
  # to the data structure in which they occur (?)
  with incr x = x + 1;

  "five": (incr 4),

  # this entire file denotes the JSON document
  # { "one":   1,
  #   "two":   2.0,
  #   "three": ["s", "s", "0"],
  #   "four":  4,
  #   "five":  5
  # }

}