lang: some small, unfinished stuff

This commit is contained in:
Schrottkatze 2024-04-07 01:04:02 +02:00
parent b6e304fa78
commit 8d7401531e
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
3 changed files with 13 additions and 20 deletions

View file

@ -100,14 +100,3 @@ pub(crate) fn parser<
decls: IndexMap::from_iter(decls),
}))
}
pub mod asg {
use std::collections::BTreeMap;
use petgraph::{adj::NodeIndex, data::Build, graph::DiGraph};
use super::{ast::Expr, Spanned};
pub struct Asg<'src> {
ast: Expr<'src>,
}
}

View file

@ -28,18 +28,18 @@ pub enum Expr<'src> {
Option<Spanned<IndexMap<Spanned<&'src str>, Expression<'src>>>>,
),
SimplePipe(Box<Expression<'src>>, Box<Expression<'src>>),
NamingPipe(
Box<Expression<'src>>,
(Vec<Spanned<&'src str>>, Vec<Spanned<&'src str>>),
Box<Expression<'src>>,
),
// NamingPipe(
// Box<Expression<'src>>,
// (Vec<Spanned<&'src str>>, Vec<Spanned<&'src str>>),
// Box<Expression<'src>>,
// ),
MappingPipe(Box<Expression<'src>>, Box<Expression<'src>>),
NullPipe(Box<Expression<'src>>, Box<Expression<'src>>),
MultiPipe(IndexMap<Spanned<&'src str>, Expression<'src>>),
LetIn(
IndexMap<Spanned<&'src str>, Box<Expression<'src>>>,
Box<Expression<'src>>,
),
// LetIn(
// IndexMap<Spanned<&'src str>, Box<Expression<'src>>>,
// Box<Expression<'src>>,
// ),
// $
Var(&'src str),
// @

View file

@ -10,6 +10,10 @@ pub enum Token<'a> {
// so a declaration needs the keyword def until i can figure this out
#[token("def")]
Def,
#[token("let")]
Let,
#[token("in")]
In,
#[regex("[a-zA-Z0-9_\\-]+", |lex| lex.slice())]
Word(&'a str),
#[regex("\\$[a-zA-Z0-9_\\-]+", |lex| &lex.slice()[1..])]