finished move to rust
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
use std::str::FromStr;
|
||||
use crate::ast;
|
||||
|
||||
grammar(id_generator: &ast::IdGenerator);
|
||||
|
||||
@@ -9,9 +9,7 @@ extern crate lalrpop_util;
|
||||
lalrpop_mod!(pub grammar); // synthesized by LALRPOP
|
||||
|
||||
use std::fs;
|
||||
use std::io::Write;
|
||||
// mod compiler;
|
||||
// use inkwell::context::Context;
|
||||
|
||||
extern crate clap;
|
||||
use clap::{App, Arg};
|
||||
|
||||
@@ -49,7 +47,7 @@ fn main() {
|
||||
.last()
|
||||
.unwrap()
|
||||
.clone();
|
||||
let output = matches.value_of("OUTPUT").unwrap_or(default_output);
|
||||
let _output = matches.value_of("OUTPUT").unwrap_or(default_output);
|
||||
|
||||
let contents = fs::read_to_string(input).expect("input file not found");
|
||||
let unknown_id_gen = ast::IdGenerator::new();
|
||||
|
||||
@@ -148,15 +148,6 @@ impl Context {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
fn add_type(&self, name: String, type_decl: &ast::TypeDeclaration) -> Context {
|
||||
let mut ctx = self.clone();
|
||||
ctx.environment.insert(
|
||||
name.to_string(),
|
||||
NamedEntity::TypeDeclaration(type_decl.clone()),
|
||||
);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
fn set_current_function_return(&self, function: &ast::TypeUsage) -> Context {
|
||||
let mut ctx = self.clone();
|
||||
ctx.current_function_return = Some(function.clone());
|
||||
@@ -183,7 +174,7 @@ fn type_exists(ctx: &Context, type_: &ast::TypeUsage) -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
ast::TypeUsage::Unknown(unknown) => {} // do nothing
|
||||
ast::TypeUsage::Unknown(_) => {} // do nothing
|
||||
ast::TypeUsage::Function(function) => {
|
||||
let mut errs = vec![];
|
||||
for arg in function.arguments.iter() {
|
||||
|
||||
Reference in New Issue
Block a user