Skip to content

Commit

Permalink
Rework the language syntax.
Browse files Browse the repository at this point in the history
Split into command mode and expression mode.
  • Loading branch information
Axel Liljencrantz committed Jul 13, 2024
1 parent b5da49f commit 7f9dc95
Show file tree
Hide file tree
Showing 16 changed files with 1,253 additions and 350 deletions.
17 changes: 17 additions & 0 deletions ideas
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
Math mode:

Stop comingling math and regular "shell" syntax. Use m() to enter math mode, e.g

$foo = m($foo + $bar)

in math mode, +, -, *, /, and ^ perform math operations. Outside math mode, the do not.

Outside of math mode, * is the wildcard operator.

Similarly, we drop regular expression literals and switch to regular expression mode, e.g.

re(.*)

Regular expression mode is similar to "regular" eregexes, but are whitespace insensitive (use backslash + space
for a space, \n for a newline, etc. regexp mode still has comments.

Graphs:

Graphs consist of two data types: nodes and edges.
Expand Down
542 changes: 542 additions & 0 deletions src/lang/ast/lexer.rs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/lang/ast/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ impl Location {
self.end - self.start
}
}

impl From<usize> for Location {
fn from(value: usize) -> Self {
Location{
start: value,
end: value+1
}
}
}
Loading

0 comments on commit 7f9dc95

Please sign in to comment.