Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree-Sitter Grammar updates to make #5321

Open
67 of 74 tasks
OceanOak opened this issue Mar 11, 2024 · 1 comment
Open
67 of 74 tasks

Tree-Sitter Grammar updates to make #5321

OceanOak opened this issue Mar 11, 2024 · 1 comment

Comments

@OceanOak
Copy link
Collaborator

OceanOak commented Mar 11, 2024

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?
@StachuDotNet
Copy link
Member

StachuDotNet commented Mar 18, 2024

Source file:

I think this should include 'module declaration' too.

For now, in the same nested way that we define modules with the F#-friendly parser.
Later, we (a few weeks from now) can handle more succinct declarations as well (i.e. module A.B.C at the top of the 'file')

@StachuDotNet StachuDotNet changed the title Grammar updates to make Tree-Sitter Grammar updates to make Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants