Skip to content
/ customs Public

👮 Customs Programming Language Compiler

Notifications You must be signed in to change notification settings

mloaf/customs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites

customs is a domain-specific language (DSL) for defining constraints of APIs

The specs of customs language is defined in this blueprint

About

This is a compiler for customs language written in Golang. It compiles the customs language into a YAML schema.

Stages

  • 18/02/2024 first release
  • 19/02/2024 major refactoring

Define Language Specs

  • Define the language

Lexer

  • Define tokens
    • Support float, string, integer, boolean
  • Implement scanner

Parser

  • Implement sane error handler

  • Implement expression parser

    • Parse unary expression
    • Parse binary expression
    • Parse token expression
    • Parse boolean expression
    • Support parenthesis
    • Support string expression
  • Implement statement parser

    • Implement constraint statement
    • Implement let statement
    • Implement assert statement

Semantic Analysis

  • Variable type inference

  • Implement semantic analysis

    • Check for duplicate identifier
    • Check for undeclared identifier
    • Check for type mismatch
    • Check assert expression cross constraints

Code Generation

  • Implement ast to targeted yaml file

Todo

Minor changes

  • Support float, string and boolean
  • Support parenthesis
  • Implement error handler, quick return error when error is found
  • Restrict only assert statements are allowed to be nested in other assert statements
  • Refactor the codebase

Major changes

  • Supports inheritance (abstract and extends)
  • Implement WASM for this compiler

Contact

For any concern please contact me at this email