Visualizzazione dei risultati da 1 a 4 su 4

Discussione: [OT] Horror Code

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2008
    Messaggi
    475

    [OT] Horror Code

    Ho trovato questa perla in un articolo su come implementare un interprete... in questo momento sta spiegando come funziona un Recursive Descent Parser, e fa vedere questi due metodi che sono a dir poco *GENIALI*.

    codice:
    typedef const unsigned char* Iterator;
    bool MatchesDigits(Iterator& it)         //[0-9]Digits?
    
    {
       return (*it>='0' && *it<='9'?(++it,true):false)//[0-9]
    
          &&  (MatchesDigits(it),true);               //Digits?
    
    }
    bool MatchesEnclosedDigits(Iterator& it) //Digits | '(' EnclosedDigits ')'
    
    {
       Iterator itSave= it;
       return
          MatchesDigits(it)                          // Digits
    
       ||                                            // |
    
           (   (itSave=it,
                  (*it=='('?(++it,true):false)       //  '('
    
                && MatchesEnclosedDigits(it)         //   EnclosedDigits
    
                && (*it==')'?(++it,true):false)      //  ')'
    
               )
             ||(it=itSave,false)
           );                     
    }
    Cioè... che altro dire se non WHAT!?
    "Let him who has understanding reckon the number of the beast, for it is a human number.
    Its number is rw-rw-rw-."

  2. #2
    Suppongo che questa non sia la sezione adatta..


    Ciao

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2008
    Messaggi
    475
    C'è un OT nel titolo infatti
    "Let him who has understanding reckon the number of the beast, for it is a human number.
    Its number is rw-rw-rw-."

  4. #4
    C'è una sezione apposita infatti..

    Comunque concordo nell'affermare la complessità del codice postato, sembra una versione facile del SymbianC++


    Ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.