Skip to content

crutchcorn/the-lovely-language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.