Attila's Blog

About writing your own programming language in C, Go and Swift

The ASPL language - part 1

Jul 18, 2018 Comments

Categories: aspl
Tags: aspl

Well, here we are. In the previous posts we laid out everything to start working on our language. For this blog I chose something of my own design, called ASPL. It stands for “Attila’s Simple Programming Language”. :D

To write the first (in my case third, actually) language I wanted to have something very simple to save myself a ton of headaches.

My design goals for the implementation are as follows.

I wanted to have:

  • Compiled into bytecode
  • Runs in a virtual machine
  • Something with C-like syntax, so I will be comfortable with it along with everyone else
  • A high-level scripting language
  • A dynamic type system – because implementing a static type system is a huge pain and requires serious effort
  • Automatic memory management via garbage collection
  • An imperative language
  • Comments
    • C–style: /* This is a comment */
    • C++–style: // This is also a comment
  • A handful of built-in data types
    • Integer
    • Double
    • Boolean
    • String
    • Nil / Null
  • Operators and expressions
    • Arithmetic
      • +
      • -
      • *
      • /
      • ++
    • Ternary
    • Comparison
      • <
      • <=
      • >
      • >=
    • Equality
      • ==
      • !=
    • Logical
      • AND: &
      • OR: |
      • NOT: !
  • Operator precedence
  • Statements: Statements are terminated with “;”
  • Code blocks and scope: { … }
  • Variables
    • Global
    • Local
  • Control flow
    • If
    • While
    • For
  • Functions
    • Global
    • Local
  • Closures
  • Object oriented
    • Classes
    • Inheritance
  • A small standard library

I think this strikes a good balance between being easy to implement and usable in real–life.

Next time I will provide some details about these features.

Stay tuned. I’ll be back.

Tags: aspl

← Language runtime The ASPL language - part 2 →

comments powered by Disqus