Skip to content

Commit 49408a3

Browse files
committed
begin writing parser
1 parent 3d6157e commit 49408a3

File tree

4 files changed

+46
-15
lines changed

4 files changed

+46
-15
lines changed

argus-parser/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ edition = "2021"
66
[dependencies]
77
argus-core = { version = "0.1.0", path = "../argus-core" }
88
ariadne = "0.3.0"
9-
chumsky = "0.9.2"
9+
chumsky = "1.0.0-alpha.4"

argus-parser/src/lexer.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use std::collections::HashMap;
2+
use std::{env, fmt, fs};
3+
4+
use ariadne::{sources, Color, Label, Report, ReportKind};
5+
use chumsky::prelude::*;
6+
7+
pub type Span = SimpleSpan<usize>;
8+
9+
#[derive(Clone, Debug, PartialEq)]
10+
pub enum Token<'src> {
11+
Semicolon,
12+
LBracket,
13+
RBracket,
14+
LParen,
15+
RParen,
16+
Comma,
17+
Bool(bool),
18+
Num(&'src str),
19+
Ident(&'src str),
20+
Minus,
21+
Plus,
22+
Times,
23+
Divide,
24+
Lt,
25+
Le,
26+
Gt,
27+
Ge,
28+
Eq,
29+
Neq,
30+
Assign,
31+
Not,
32+
And,
33+
Or,
34+
Implies,
35+
Xor,
36+
Equiv,
37+
Next,
38+
Always,
39+
Eventually,
40+
Until,
41+
}

argus-parser/src/lib.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
//! # Argus logic syntax
2+
#![allow(dead_code)]
23

3-
pub fn add(left: usize, right: usize) -> usize {
4-
left + right
5-
}
6-
7-
#[cfg(test)]
8-
mod tests {
9-
use super::*;
10-
11-
#[test]
12-
fn it_works() {
13-
let result = add(2, 2);
14-
assert_eq!(result, 4);
15-
}
16-
}
4+
mod lexer;
5+
mod parser;

argus-parser/src/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)