-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ use lexer::{tokenize, TokenKind}; | |
|
||
mod lexer; | ||
mod ops; | ||
mod parser; | ||
mod runtime; | ||
mod span; | ||
mod symbol; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::lexer::{cursor::Cursor, TokenKind}; | ||
|
||
/// Transforms token stream into 'AST' | ||
pub struct Parser<'source> { | ||
/// Reference to the source file | ||
src: &'source str, | ||
/// Used to parse tokens | ||
cur: Cursor<'source>, | ||
} | ||
|
||
impl<'a> From<&'a str> for Parser<'a> { | ||
fn from(value: &'a str) -> Self { | ||
Parser { | ||
src: value, | ||
cur: Cursor::new(value), | ||
} | ||
} | ||
} | ||
|
||
impl<'source> Parser<'source> { | ||
pub fn parse(&self) { | ||
// First, check that there is an .orig directive with an appropriate value. | ||
todo!() | ||
} | ||
|
||
pub fn expect(kind: TokenKind) { | ||
todo!() | ||
} | ||
|
||
pub fn parse_direc(&self) { | ||
todo!() | ||
} | ||
|
||
pub fn parse_op(&self) { | ||
todo!() | ||
} | ||
} |