Skip to content
A toy language to learn about language design
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
specification Add readme and update intro.md Jul 7, 2019
src Change error handling output Jul 17, 2019
LICENSE
README.md Removes closures from spec and updates language goals Jul 17, 2019
pom.xml Merge pull request #1 from supergrecko/dependabot/maven/org.junit.jup… Jul 9, 2019

README.md

13

13 is a programming language I'm designing for research and learning purposes. It's not supposed to be ran in production and is likely full of bugs.

Foundation

The language has a few principles which are the foundation for the language.

  • Classes can only have a single super class
  • Variable shadowing is not allowed
  • Null does not exist
  • Variables must be initialized with a value
  • Return must return an expression
  • Class declarations are hoisted to top of block
  • Class declarations can only be in the top-level scope
  • The language has only 13 reserved keywords.

The language is an indentation based language though it does not heavily rely on indentation like python. Its syntax is heavily inspired by Ruby and is almost identical Ruby.

The given examples are evaluated in the same way.

if (true) then 
    main();
end
if (true) then main(); end

This demonstrates the expected syntax for the language while proving that indentation does not matter.

The thirteen keywords

I wanted to make 13 simple so I stuck with a rule which allows a max of thirteen reserved keywords.

  • if
  • else
  • for
  • break
  • func
  • val
  • class
  • return
  • end
  • this
  • true
  • false

Theory

The compiler runs multiple passes on the syntax tree. The stages from source to interpretation is listed below

  • Source -> Token List
  • Token List -> Syntax Tree
  • Syntax Tree -> Interpreter

This is because we need to process the compiler directives (such as includes), then we can optimize the AST and then finally interpret it.

Roadmap

13 is currently in a development phase.

  • Lexer / Tokenizer
  • Parser / Syntax Tree
  • JVM Interpreter
You can’t perform that action at this time.