Skip to content

Conversation

@Flecart
Copy link
Collaborator

@Flecart Flecart commented Dec 8, 2022

No description provided.

@giospada giospada self-requested a review December 8, 2022 19:21
@Flecart Flecart force-pushed the feat/items-grammar branch from 58ba95b to af713a3 Compare December 8, 2022 19:27
Copy link
Owner

@giospada giospada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non compila

Copy link
Owner

@giospada giospada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

riga 88: _first può può andare in loop infinito?

@Flecart
Copy link
Collaborator Author

Flecart commented Dec 8, 2022

riga 88: _first può può andare in loop infinito?

credo proprio di sì, fixo

@giospada
Copy link
Owner

giospada commented Dec 8, 2022

boh, io cambierei un po' tutto

@giospada
Copy link
Owner

giospada commented Dec 8, 2022

io creerei una struttura, per i first e i follow e mi atterrei al codice del prof,
poi farei una struttura per i nullable
e queste strutture le passi in giro, per esempio non puoi calcolare il first se prima non hai calcolato i nullable perchè glie lo passi per riferimento

@giospada
Copy link
Owner

giospada commented Dec 8, 2022

anche per ridurrei la lunghezza dei del file che è lunghissimo

@giospada
Copy link
Owner

giospada commented Dec 8, 2022

per esempio la struttura first si memorizza la tabella dei first

@giospada
Copy link
Owner

giospada commented Dec 8, 2022

cosa ne dici?

@Flecart
Copy link
Collaborator Author

Flecart commented Dec 8, 2022

cosa ne dici?

Ridurre la lunghezza e ordinare un pò le cose sì.
Per first e follow cosa intendi? Dici di precalcolarli tutti?
E poi cosa intendi per il codice del prof? Io mi ricordo di averlo fatto seguendo il codice del prof.

@Flecart Flecart force-pushed the feat/items-grammar branch from b08a92b to b6708cd Compare December 8, 2022 20:32
@giospada
Copy link
Owner

giospada commented Dec 8, 2022

si io i first and follow li precalcolerei in una struttura esterna, e poi passerei quella struttura per le altre funzioni a cui serve

@giospada
Copy link
Owner

giospada commented Dec 8, 2022

l'algoritmo delle dei first and follow lo trovi sulle slide

Flecart and others added 2 commits December 11, 2022 11:39
* feat(first_follow): first version

* test(first_follow): move tests

* test(first_follow): remove old implementation of first and follow

* test(first_follow): fix tests and first bug
Copy link
Owner

@giospada giospada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Io incomincierei a fare un piccolo refactor su questa parte, per esempio non mi piace la first and follow table, le terrei come due cose separate

Letter::NonTerminal(idx) => self.first_table.as_ref().unwrap()[*idx].clone(),
Letter::Terminal(ch) => {
let mut set = BTreeSet::new();
set.insert(*ch);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTreeSet::from(*ch)

@giospada
Copy link
Owner

inoltre credo che come prima cosa bisognerebbe mettere aposto l'alfabeto, creare un alfabeto unico che possa essere utilizzato in tutta l'applicazione

@giospada
Copy link
Owner

Item non sarebbe il caso di metterlo in un altro gruppo di directory tipo LR parser?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants