can compile now

parent 4169420f
......@@ -45,7 +45,7 @@ mod lexer {
}, text)
}
// detects a string
r#"[a-zA-Z\u00C0-\u017F_][a-zA-Z0-9\u00C0-\u017F_]*"# => (Token::Ident(text.to_owned()), text),
r#"[a-zA-Z_][a-zA-Z0-9_]*"# => (Token::Ident(text.to_owned()), text),
// detects a =
r#"="# => (Token::Equals, text),
// detects a +
......@@ -119,7 +119,7 @@ mod lexer {
}
mod ast {
use lexer::Span;
use crate::lexer::Span;
// un Program est un vecteur d'expressions
#[derive(Debug)]
......@@ -148,9 +148,9 @@ mod ast {
}
mod parser {
use ast::*;
use lexer::Token::*;
use lexer::*;
use crate::ast::*;
use crate::lexer::Token::*;
use crate::lexer::*;
use plex::parser;
parser! {
fn parse_(Token, Span);
......@@ -233,7 +233,7 @@ mod parser {
}
mod interp {
use ast::*;
use crate::ast::*;
use std::collections::HashMap;
pub fn interp<'a>(p: &'a Program) {
......@@ -243,7 +243,7 @@ mod interp {
}
}
fn interp_expr<'a>(env: &mut HashMap<&'a str, i64>, expr: &'a Expr) -> i64 {
use ast::Expr_::*;
use crate::ast::Expr_::*;
match expr.node {
Add(ref a, ref b) => interp_expr(env, a) + interp_expr(env, b),
Sub(ref a, ref b) => interp_expr(env, a) - interp_expr(env, b),
......@@ -272,6 +272,3 @@ fn main() {
let program = parser::parse(lexer).unwrap();
interp::interp(&program);
}
fn main() {
println!("Hello, world!");
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment