Skip to content

feat/items-grammar, closures and goto#13

Open
Flecart wants to merge 13 commits into
mainfrom
feat/items-grammar
Open

feat/items-grammar, closures and goto#13
Flecart wants to merge 13 commits into
mainfrom
feat/items-grammar

Conversation

@Flecart

@Flecart Flecart commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator

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

@giospada giospada left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

non compila

Comment thread src/grammar/grammar.rs

@giospada giospada left a comment

Copy link
Copy Markdown
Owner

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

Flecart commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator Author

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

credo proprio di sì, fixo

@giospada

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

boh, io cambierei un po' tutto

@giospada

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

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

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

anche per ridurrei la lunghezza dei del file che è lunghissimo

@giospada

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

per esempio la struttura first si memorizza la tabella dei first

@giospada

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

cosa ne dici?

@Flecart

Flecart commented Dec 8, 2022

Copy link
Copy Markdown
Collaborator Author

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

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

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

giospada commented Dec 8, 2022

Copy link
Copy Markdown
Owner

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

@giospada giospada left a comment

Copy link
Copy Markdown
Owner

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

Comment thread src/grammar/first_follow.rs Outdated
Letter::NonTerminal(idx) => self.first_table.as_ref().unwrap()[*idx].clone(),
Letter::Terminal(ch) => {
let mut set = BTreeSet::new();
set.insert(*ch);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

BTreeSet::from(*ch)

Comment thread src/grammar/first_follow.rs Outdated
@giospada

Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants