Skip to content

Commit

Permalink
fixed some typos (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkatychev authored Mar 9, 2024
1 parent 488ca12 commit 6229a82
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Parallel evaluation: with introduction of `ascent_par!` and `ascent_run_par!` macros, Ascent programs can utilize multiple CPU cores to speed up evaluation.

- Made imporvements to handling of rules that start with `if`, `let`, or `for` (they can be simple joins).
- Made improvements to handling of rules that start with `if`, `let`, or `for` (they can be simple joins).

## 0.4.0
- Reduced the size of generated code for a rule with N dynamic relations from O(N * 2^N) to O(N^2);
Expand Down
2 changes: 1 addition & 1 deletion ascent/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ pub struct TypeConstraints<T> where T : Clone + Eq + Hash{_t: ::core::marker::Ph
/// type constraints for a lattice
pub struct LatTypeConstraints<T> where T : Clone + Eq + Hash + Lattice{_t: ::core::marker::PhantomData<T>}

/// type contraints for parallel Ascent
/// type constraints for parallel Ascent
pub struct ParTypeConstraints<T> where T: Send + Sync {_t: ::core::marker::PhantomData<T>}

#[inline(always)]
Expand Down
6 changes: 3 additions & 3 deletions ascent_macro/src/ascent_codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ fn compile_mir_rule_inner(rule: &MirRule, scc: &MirScc, mir: &AscentMir, par_ite

let vars_assignments = clause_var_assignments(
&MirRelation::from(agg.rel.clone(), MirRelationVersion::Total), agg_args_tuple_indices,
&parse_quote_spanned!{agg.span=> __val}, &parse_quote_spanned!{agg.span=>__agregated_rel},
&parse_quote_spanned!{agg.span=> __val}, &parse_quote_spanned!{agg.span=>__aggregated_rel},
false, mir
);

Expand All @@ -873,10 +873,10 @@ fn compile_mir_rule_inner(rule: &MirRule, scc: &MirScc, mir: &AscentMir, par_ite
let _self = quote!{ _self };
quote_spanned! {agg.span=>
let __matching = #rel_version_var_name.index_get( &#selected_args_tuple);
let __agregated_rel = &#_self.#rel_name;
let __aggregated_rel = &#_self.#rel_name;
let __agg_args = __matching.into_iter().flatten()
.map(|__val| {
// let __row = &__agregated_rel[__val];
// let __row = &__aggregated_rel[__val];
#vars_assignments
#agg_args_tuple
});
Expand Down
6 changes: 3 additions & 3 deletions ascent_macro/src/ascent_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ pub(crate) fn rule_node_summary(rule: &RuleNode) -> String {

#[derive(Parse)]
pub struct MacroDefParam {
dollor: Token![$],
dollar: Token![$],
name: Ident,
colon: Token![:],
kind: MacroParamKind
Expand Down Expand Up @@ -775,10 +775,10 @@ fn rule_desugar_repeated_vars(mut rule: RuleNode) -> RuleNode {
let mut new_cond_clauses = vec![];
for arg_ind in 0..cl.args.len() {
let expr = cl.args[arg_ind].unwrap_expr_ref();
let expr_has_vars_from_same_caluse =
let expr_has_vars_from_same_clause =
expr_get_vars(&expr).iter()
.any(|var| if let Some(cl_ind) = grounded_vars.get(&var) {*cl_ind == i} else {false});
if expr_has_vars_from_same_caluse {
if expr_has_vars_from_same_clause {
let new_ident = fresh_ident(&expr_to_ident(expr).map(|e| e.to_string()).unwrap_or_else(|| "expr_replaced".to_string()), expr.span());
new_cond_clauses.push(CondClause::If(
parse2(quote_spanned! {expr.span()=> if #new_ident.eq(&(#expr))}).unwrap()
Expand Down
2 changes: 1 addition & 1 deletion ascent_macro/src/syn_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ pub fn expr_visit_free_vars_mbm(expr: reft([Expr]), visitor: &mut dyn FnMut(reft
Expr::Lit(_) => {}
Expr::Loop(l) => block_visit_free_vars_mbm(reft([l.body]), visitor),
Expr::Macro(m) => {
eprintln!("WARNING: cannot determine free varaibles of macro invocations. macro invocation:\n{}",
eprintln!("WARNING: cannot determine free variables of macro invocations. macro invocation:\n{}",
expr.to_token_stream())
},
Expr::Match(m) => {
Expand Down
4 changes: 2 additions & 2 deletions ascent_macro/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn token_stream_replace_macro_idents(input: TokenStream, ident_replacements:
for tt in ts {
if let Some(dollar) = last_dollar.take() {
let is_match = match &tt {
TokenTree::Ident(after_dollor_ident) => ident_replacements.get(after_dollor_ident),
TokenTree::Ident(after_dollar_ident) => ident_replacements.get(after_dollar_ident),
_ => None
};
if let Some(replacement) = is_match {
Expand Down Expand Up @@ -202,7 +202,7 @@ pub fn token_stream_replace_macro_ident(input: TokenStream, ident: &Ident, repla
for tt in ts {
if let Some(dollar) = last_dollar.take() {
let is_match = match &tt {
TokenTree::Ident(after_dollor_ident) => ident == after_dollor_ident,
TokenTree::Ident(after_dollar_ident) => ident == after_dollar_ident,
_ => false
};
if is_match {
Expand Down
10 changes: 5 additions & 5 deletions ascent_tests/src/example_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn test_generic_tc_example() {
#[test]
fn test_borrowed_strings() {
ascent_m_par! {
struct Ancestory<'a>;
struct Ancestry<'a>;
relation parent(&'a str, &'a str);
relation ancestor(&'a str,&'a str);

Expand All @@ -104,7 +104,7 @@ fn test_borrowed_strings() {

let parent_rel = vec![(james.clone(), harry.clone()), (harry.clone(), albus.clone())];

let mut prog = Ancestory::default();
let mut prog = Ancestry::default();
// prog.parent = vec![(&zal[..], &rostam[..]), (&rostam[..], &sohrab[..])];
prog.parent = parent_rel.iter().map(|(p, c)| (&p[..], &c[..])).collect();
prog.run();
Expand All @@ -115,9 +115,9 @@ fn test_borrowed_strings() {
#[test]
fn test_borrowed_strings_2() {

fn ancestory_fn<'a>(parent_rel: impl Iterator<Item = (&'a str, &'a str)>) -> Vec<(&'a str, &'a str)> {
fn ancestry_fn<'a>(parent_rel: impl Iterator<Item = (&'a str, &'a str)>) -> Vec<(&'a str, &'a str)> {
ascent_run_m_par! {
struct Ancestory<'a>;
struct Ancestry<'a>;
relation parent(&'a str, &'a str) = parent_rel.collect();
relation ancestor(&'a str,&'a str);

Expand All @@ -133,7 +133,7 @@ fn test_borrowed_strings_2() {
let albus = "Albus".to_string();

let parent_rel = vec![(james.clone(), harry.clone()), (harry.clone(), albus.clone())];
let ancestor = ancestory_fn(parent_rel.iter().map(|(x, y)| (&x[..], &y[..])));
let ancestor = ancestry_fn(parent_rel.iter().map(|(x, y)| (&x[..], &y[..])));
println!("ancestors: {:?}", ancestor);
assert_eq!(ancestor.len(), 3);
}

0 comments on commit 6229a82

Please sign in to comment.