First steps…

So today we took the first steps, and tried to define some control structures and operators for our language. In the following documentation the symbol # will be used as a magic placeholder. This is what we came up with.

  • To give us a greater freedom in the number department of our language, and because we like while-loops, we have decided NOT to include for-loops.
  • We will implement a for all-loop in the language with the following syntax:
    for all # in #

    Note that this loop does not iterate through the datastructure in any specific order, and that it will want to have a lot of processes running at the same time, given that they are safe.

  • A standard if sentence will be implemented:
    if # then # else #
  • As mentioned before, we like while-loops:
    while #
  • The following choices concerning operators were made:
    # + # (add # to #, if # are scalars; concatenate # and #, if # are strings)
    # – # (subtract # from #)
    # * # (multiply # with #)
    # / # (divide # with #)
    # := # (# becomes #)
    # mod # or # % # (# modulo #, which notation has not yet been chosen)
    #^# (empower # by #)
    # and # (and operator, for logical expressions)
    # or # (or operator, for logical expresseions)
    # = # (compare # to #)
    # <> # (# is different from #)
    |#| (the absolute value of #, if # is a scalar; the lenght of #, if # has one)

That is all for today. I hope I didn’t make too many typos.

~Kim

Explore posts in the same categories: Syntax & Semantics

One Comment on “First steps…”

  1. moccalotto Says:

    Nice.!

    We shall soon be ready to EBNF this.


Comment:

You must be logged in to post a comment.