Feature: Tokenize Punctuation #9

Closed
opened 2023-09-25 22:21:48 +00:00 by j · 1 comment
Owner

Feature Progress

  • Create operator/punctuation types
    • Semi ;
    • Dot .
    • Star *
    • Slash /
    • Plus +
    • Minus -
    • Rem %
    • Bang !
    • Eq =
    • Lt <
    • Gt >
    • And &
    • Or |
    • Xor ^
  • Decide if operators should compound at token level?
    • Lsh <<
    • Rsh >>
    • AndAnd &&
    • OrOr ||
    • CatEar ^^
    • EqEq ==
    • NotEq !=
    • StarEq *=
    • DivEq /=
    • AddEq +=
    • SubEq -=
    • LshEq <<=
    • RshEq >>=
    • etc.
  • Create tests for tokenizing each type
  • Define rules for tokenizing each type

Feature description

Operators are the heart of any programming language. Conlang, being an expression language, has a variety:

  • Ignore operator: ;
  • Dereference operator: *
  • Member operator: .
  • Arithmetic operators: *, /, +, -
    • Mul-precedence: *, /
    • Add-precedence: +, -
  • Bitwise operators
    • Not: ! (unary)
    • Shift: << >>
    • Logic: &, |, ^
  • Boolean operators
    • Not: ! (unary)
    • Equality: == !=
    • Logic: &&, ||
  • Assignment operators
    • Plain: =
    • Arithmetic: *=, /=, +=, -=
    • Bitwise: <<=, >>=, &=, |=, ^=
  • etc.

Example

let x = {
    let a = arr.len() - 1; let b = 10;
    while (b < a) { if arr[b] == arr[a] { break b } }
    else a
}
# Feature Progress <!-- Describe the steps for implementing this feature in libconlang --> - [x] Create operator/punctuation types - [x] Semi `;` - [x] Dot `.` - [x] Star `*` - [x] Slash `/` - [x] Plus `+` - [x] Minus `-` - [x] Rem `%` - [x] Bang `!` - [x] Eq `=` - [x] Lt `<` - [x] Gt `>` - [x] And `&` - [x] Or `|` - [x] Xor `^` - [x] Decide if operators should compound at token level? - [x] Lsh `<<` - [x] Rsh `>>` - [x] AndAnd `&&` - [x] OrOr `||` - [x] CatEar `^^` - [x] EqEq `==` - [x] NotEq `!=` - [x] StarEq `*=` - [x] DivEq `/=` - [x] AddEq `+=` - [x] SubEq `-=` - [x] LshEq `<<=` - [x] RshEq `>>=` - [x] etc. - [x] Create tests for tokenizing each type - [x] Define rules for tokenizing each type # Feature description <!-- [Feature name] does a cool thing that you should describe here --> Operators are the heart of any programming language. Conlang, being an expression language, has a variety: - Ignore operator: `;` - Dereference operator: `*` - Member operator: `.` - Arithmetic operators: `*`, `/`, `+`, `-` - Mul-precedence: `*`, `/` - Add-precedence: `+`, `-` - Bitwise operators - Not: `!` (unary) - Shift: `<<` `>>` - Logic: `&`, `|`, `^` - Boolean operators - Not: `!` (unary) - Equality: `==` `!=` - Logic: `&&`, `||` - Assignment operators - Plain: `=` - Arithmetic: `*=`, `/=`, `+=`, `-=` - Bitwise: `<<=`, `>>=`, `&=`, `|=`, `^=` - etc. # Example <!-- Demonstrate this feature with a clear, concise code example Right now, we're (ab)using Rust syntax highlighting, since it most closely matches what I'm currently aiming for --> ```rust let x = { let a = arr.len() - 1; let b = 10; while (b < a) { if arr[b] == arr[a] { break b } } else a } ```
j added the
enhancement
label 2023-09-25 22:21:48 +00:00
j added this to the Basic Syntax project 2023-09-25 22:21:48 +00:00
j changed title from Feature: Tokenize Operators and Punctuation to Feature: Tokenize Punctuation 2023-09-25 23:39:57 +00:00
Author
Owner

This feature has been implemented. Things left to consider:

  • Operator overloading vs. user-defined operators
    • Are operators a language feature?
  • How are operators defined?
    • Syntactic sugar approach?
    • AST substitution?
    • Parser problem.
This feature has been implemented. Things left to consider: - Operator overloading vs. user-defined operators - Are operators a language feature? - How are operators defined? - Syntactic sugar approach? - AST substitution? - Parser problem.
j closed this issue 2023-09-28 05:23:22 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: j/Conlang#9
No description provided.