• Welcome to TUKE FÓRUM - Fórum pre študentov Technickej Univerzity v Košiciach.
 

Modelovanie a Generovanie Softverovych Architektur

Started by jaros51, 03.03.2009, 21:21:35

« predchdzajce - alie »

psicho

read my blog> www.codemazing.com <read my blog

Raleon



There is no such bad temper that can not be fixed with some good wine.

pUf

kvoli 5 bodom si takto nicite zdravie po nociach :D
pUf :zuzka: ywetku (teh one and only :D)
~ ~ ~ ~ ~ ~ ~ ~
Support my band :) :P
bandzone
facebook

LM

Otazka ku skuske:
Napíšte syntaktický analyzátor so zotavením, teda doplnte telá procedúr Error, Check
a A pre pravidlo:
A -> [B|c]{d|E}F
za predpokladu, že množiny H(B), H(E), and H(F) sú známe. V programe použite
HB, HE a HF, aktuálny symbol sym a procedúru getsymbol().

Riesenie:
Error (symbolset K) {
while !(sym = K) getsymbol()
}

Check( symbolset K) {
if !(sym = K) Error ()
}

A (symbolset K){
if(sym = {{c} u HB}) {
    switch (sym)
        'c': getsymbol();
        sym = HB: B ( check({d}uHEuHFuK)
                           while (sym = {{d}uHE}) {
                                    switch(sym)
                                    'd': getsymbol()
                                    sym = HE: E( check( {d} u HE u HF u K )
                           }
                           F(K)
                  )
       }
while (sym = {{d}uHE}) {
         switch(sym)
               'd': getsymbol()
               sym = HE: E( check( {d} u HE u HF u K )
}
F(K)



Otazka: moze to byt takto ?
Hardware: the parts of a computer that can be kicked.
- Jeff Pesis

   Who's General Failure and why's he reading my disk?
- Anonymous

   Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
- Andrew Brown

LM

a mam este jednu otazku k prikladu 4a:
T[[ while ... ]] = catch <L2> e[[Expr]] falsejump<L1> s[[Stat_seq]] jump <L2> catch <L1>

malo by to byt takto, ale to co som si opisal z tabule, kde myslim bolo:
e[[Expr]] falsejump<L1> s[[Stat_seq]] catch <L1>
lebo toto sa mi nezda ako loop ?!
Hardware: the parts of a computer that can be kicked.
- Jeff Pesis

   Who's General Failure and why's he reading my disk?
- Anonymous

   Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
- Andrew Brown

pUf

Quote from: LM on  12.05.2009, 19:28:30
a mam este jednu otazku k prikladu 4a:
T[[ while ... ]] = catch <L2> e[[Expr]] falsejump<L1> s[[Stat_seq]] jump <L2> catch <L1>

malo by to byt takto, ale to co som si opisal z tabule, kde myslim bolo:
e[[Expr]] falsejump<L1> s[[Stat_seq]] catch <L1>
lebo toto sa mi nezda ako loop ?!

tam miesto catch je label tusim :P
a to druhe veruze nie je loop lebo skaces maximalne von z toho wannabe cyklu ... povedal by som skor, ze to je IF bez vetvy else
pUf :zuzka: ywetku (teh one and only :D)
~ ~ ~ ~ ~ ~ ~ ~
Support my band :) :P
bandzone
facebook

LM

ved hej aj mne to tak pripada, ale na tabulu pisal urcite catch <label>
takze to prve je urcite s loopom, ja len ci som dobre videl... co pisal ..
Hardware: the parts of a computer that can be kicked.
- Jeff Pesis

   Who's General Failure and why's he reading my disk?
- Anonymous

   Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
- Andrew Brown

mishelka

  

#define TRUE FALSE //Happy debugging suckers :D

psicho

a co tie zapisi znamenaju? naco toje dobre? kde ich pouzijem na skuske? co snimi dosiahnem ?
read my blog> www.codemazing.com <read my blog

LM

Hardware: the parts of a computer that can be kicked.
- Jeff Pesis

   Who's General Failure and why's he reading my disk?
- Anonymous

   Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
- Andrew Brown

LM

este jedna otazka, k tym uloha m 5, o com to vlastne je ???
Hardware: the parts of a computer that can be kicked.
- Jeff Pesis

   Who's General Failure and why's he reading my disk?
- Anonymous

   Internet is so big, so powerful and pointless that for some people it is a complete substitute for life.
- Andrew Brown

bliky

to LM: oks, vidim, ze si siel domov sprtat, takze sa tesim, ze mi to zajtra vecer na izbe secko pekne vysvetlis... :)

MKI

co chces vysvetlovat bdu s a anuc tri stran ynaspamet aleob tahak 5 x 5 cm :D
www.mki.sk Kvalitne a lacne TONERY :)

mishelka

co sa na tom chcete ucit, sak to je take lahucke.. a este vsetko na prednaske podrobne vysvetlil...
  

#define TRUE FALSE //Happy debugging suckers :D

buhehe

Quote from: LM on  12.05.2009, 19:13:47
Otazka ku skuske:
A->[B|c]{d|E}F
Otazka: moze to byt takto ?
to nemas asi dobre...ja by som dal...

A (symbolset K){
if(sym in {H(B) u c}) {
    check(H(B) u c u K)
    switch (sym)
        sym in H(B): B(d u H(E) u H(F) u K)
        sym = 'c': getsymbol();
        default error(H(B) u c u K)
}
check(d u H(E) u K)
while (sym in {d u H(E)}) {
    check(d u H(E) u K)   
    switch(sym)
         sym = 'd': getsymbol()
         sym in H(E): E(d u H(E) u K)
         default error(d u H(E) u K)
    check(d u H(E) u H(F) u K)
}
F(K)
}

MKI

ocom tocite dorb enedobre sak toto toto co tu ema hodila neje dobre ?
www.mki.sk Kvalitne a lacne TONERY :)

buhehe

ano to co hodila eminkaa je spravne ale LM pisal syn. analyzator pre ine pravidlo

mishelka

Quote from: buhehe on  13.05.2009, 04:38:32
Quote from: LM on  12.05.2009, 19:13:47
Otazka ku skuske:
A->[B|c]{d|E}F
Otazka: moze to byt takto ?
to nemas asi dobre...ja by som dal...

A (symbolset K){
if(sym in {H(B) u c}) {
    check(H(B) u c u K)
    switch (sym)
        sym in H(B): B(d u H(E) u H(F) u K)
        sym = 'c': getsymbol();
        default error(H(B) u c u K)
}
check(d u H(E) u K)
while (sym in {d u H(E)}) {
    check(d u H(E) u K)   
    switch(sym)
         sym = 'd': getsymbol()
         sym in H(E): E(d u H(E) u K)
         default error(d u H(E) u K)
    check(d u H(E) u H(F) u K)
}
F(K)
}
ten default error ti je tam podla mna na figu, kedze to testujes pred switchom (check)...



inak taka otazka... aky je rozdiel medzi [] a () ???
  

#define TRUE FALSE //Happy debugging suckers :D

Mao

[] 0 alebo 1 krat, teda moze byt alebo nemusi
() prave raz

mishelka

Quote from: Mao on  13.05.2009, 05:35:23
[] 0 alebo 1 krat, teda moze byt alebo nemusi
() prave raz
moc pekne dakujem
  

#define TRUE FALSE //Happy debugging suckers :D

psicho

a tota 3ka v eminych poznamkach je spravna ? :)
read my blog> www.codemazing.com <read my blog

DeeL

QuoteOtazka ku skuske:
A->[B|c]{d|E}F
Otazka: moze to byt takto ?
no ja by som to skor dal takto:

void A (symbolset K){
check(HB u {'c'} u {'d'} u HE u HF)
if(sym in {HB u {'c'}}) {
    switch (sym)
        in HB: B({'d'} u HE u HF u K)
        'c': getSymbol()
}
check({'d'} u HE u HF u K)
while (sym in {{'d'} u HE}) {
    switch(sym)
         'd': getSymbol()
         in HE: E({'d'} u HE u HF u K)
    check({'d'} u HE u HF u K)
}
check(HF u K)
F(K)
}

pricom rozmyslam, ci ten prvy a posledny check co tam mam su uplne nutne, ale tak pre istotu to nie je zle aj ked tam su



nasledne to co dala Ema z prednasky:
A->B{dE}(c|F)
ja by som to napisal takto:

void A (Symbolset K) {
B({'d'} u HE u {'c'} u HF u K)
check({'d'} u HE u {'c'} u HF u K)
while (sym in {'d'}) {
     getSymbol()
     E({'d'} u HE u {'c'} u HF u K)
     check({'d'} u HE u {'c'} u HF u K)
}
check({'c'} u HF u K)
switch (sym)                     
     'c': getSymbol()
     in HF: F(K)
     default: Error({'c'} u HF u K)      // prv som tu mal Error(K) v podstate to podla mna aj teraz nic nemeni, jediny rozdiel je podla mna ak error zaroven robi aj vypisy pre pouzivatela
}
ale ako vravim je to moj pohlad na danu vec a este sam si niektore veci snazim ujasnit ale zatia by som to dal takto

Múdri sa naučia od hlupákov viac, ako sa hlúpi poučia z príkladu múdrych.
(Marcus Porcius C. Cato)
It's not that I'm so smart, it's just that I stay with problems longer.
(Albert Einstein)

Hi yourself ;)

ondY.ke

je nejake pravidlo ako labelovat navestia??? myslim poradie L1 L2 and so on..
http://ondytown.myminicity.com/ - everybody support my town!!!! we build this city on rock 'n roll!!!!

mishelka

myslim, ze by mali ist po poradi (povedal damien), takze ak mas skok niekam na zaciatok programu (prikazu), tak label na zaciatku by mal byt L1 (pri spracovani sa to najprv zapise). ale je to podla mna jedno, lebo toto kollar tiez len tak preleti :)
  

#define TRUE FALSE //Happy debugging suckers :D

mishelka

Quote from: DeeL on  14.05.2009, 00:03:29
QuoteOtazka ku skuske:
pricom rozmyslam, ci ten prvy a posledny check co tam mam su uplne nutne, ale tak pre istotu to nie je zle aj ked tam su


nasledne to co dala Ema z prednasky:
A->B{dE}(c|F)
ja by som to napisal takto:

void A (Symbolset K) {
B({'d'} u HE u {'c'} u HF u K)
check({'d'} u HE u {'c'} u HF u K)
while (sym in {'d'} u H(E)) {
     if(sym == 'd') getsymbol(); else error({'d'} u HE u {'c'} u HF u K);
     E({'d'} u HE u {'c'} u HF u K)
     check({'d'} u HE u {'c'} u HF u K)
}
check({'c'} u HF u K)
switch (sym)                     
     'c': getSymbol()
     in HF: F(K)
     default: Error({'c'} u HF u K)      // prv som tu mal Error(K) v podstate to podla mna aj teraz nic nemeni, jediny rozdiel je podla mna ak error zaroven robi aj vypisy pre pouzivatela
}
ale ako vravim je to moj pohlad na danu vec a este sam si niektore veci snazim ujasnit ale zatia by som to dal takto

myslim ze toto ma byt takto, lebo inak cele H(E) preskoci, cize tam musi byt ten H(E) v tom while..
  

#define TRUE FALSE //Happy debugging suckers :D