Skip to content

Tree-Sitter Grammar updates to make #5321

@OceanOak

Description

@OceanOak

We are implementing a new parser written in Darklang. This issue gathers the grammar updates that need to be done to match more of our full language.

Expressions:

  • unit
  • bool
  • signed and unsigned Ints (Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128)
  • float
  • char
    • TODO: the space in 'a ' shouldn't be ignored, and the test should fail
  • string
  • let expression
  • if/else
    • pretty-printer: fix the formatting for an if statement with an else whose root expression is also an if
    • Fix the requirement for parentheses in a then expression within an inline if/else expression
  • infix
    • +, -, *, /, %, ^, >, <, >=, <=, ==, !=, ++
    • ||, &&
  • lambda
  • field access
  • variable
  • list
  • dict
  • tuple
  • pipe
  • record
  • enum
  • match
  • record update
  • paren_expression
  • fix apply
  • constant

Type references:

  • Variable
  • Unit
  • Bool
  • Signed and Unsigned Ints (Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128)
  • Float
  • Char
  • String
  • DateTime
  • Uuid
  • List
  • Tuple
  • Dict
  • CustomType
  • DB
  • Fn

Match pattern:

  • Variable
  • Enum
  • Signed and Unsigned Ints (Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UInt128)
  • String
  • Char
  • Bool
  • Unit
  • Float
  • List
  • ListCons
  • Tuple

Source file:

  • Type declaration
    • Alias
    • Record
    • Enum
  • Function declaration
  • Constant declaration (Unit, Bool, Signed and Unsigned Ints, Float, Char, String, List, Tuple, Dict, Enum)
  • Module declaration

Other:

  • Qualified function name
  • Qualified type name
  • Comments (/// comments)
  • indentation?
  • generics ('a)?
  • type parameter (GenericThing<'thing>)?
  • string interpolation
  • wildcard (eg. Error _ ->...)?
  • DB
  • Http Handler
  • Worker
  • Cron
  • REPL?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions