Skip to content

Latest commit

 

History

History
91 lines (78 loc) · 2.18 KB

README.md

File metadata and controls

91 lines (78 loc) · 2.18 KB

The Lovely Language

playground slide

An experimental homegrown coding language.

Build Status Test Status license

The goals of this project are:

  • Fully homegrown
  • No dependencies
  • Start with lexer and parser
    • No runtime or compiler (yet)
  • Static typings
    • No runtime or build-time type checking (yet)

Syntax

infer Test = 0 + 1 + 2;
infer Other = 0;

Outputs the following AST:

{
  "type": "Program",
  "body": [
    {
      "type": "InferStatement",
      "identifier": {
        "type": "Identifier",
        "val": "Test"
      },
      "value": {
        "type": "AddStatement",
        "left": {
          "type": "Number",
          "val": "0"
        },
        "right": {
          "type": "AddStatement",
          "left": {
            "type": "Number",
            "val": "1"
          },
          "right": {
            "type": "Number",
            "val": "2"
          }
        }
      }
    },
    {
      "type": "InferStatement",
      "identifier": {
        "type": "Identifier",
        "val": "Test"
      },
      "value": {
        "type": "Number",
        "val": "0"
      }
    }
  ]
}

This project is currently held together by ducktape and string. I've never built a lexer, parser, or compiler before.

I'm learning as I go. I'm sure there are many things I'm doing wrong. I'm open to feedback.

I'm also intentionally taking the slow route at times and not referencing existing implementation or documentation at this time.