Advertisement
gmendezm

Pseudocodigo de Conversion BNF-Algoritmos

Aug 16th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. void program  () {
  2. if (token_actual.tipo == iniciadores(declarations) || token_actual.tipo == iniciadores(statements)){
  3. declarations();
  4. statements();
  5. }else if(token_actual.tipo == iniciadores(statements)){
  6.     statements();
  7. }else {
  8.     // error
  9. }
  10. }
  11.  
  12. void declarations (){
  13. declaration();
  14. accept(sym.PyCOMA);
  15.  
  16. boolean A = token_actual.tipo == sym.TINT;
  17. boolean B = token_actual.tipo == sym.TSTRING;
  18.  
  19. while(A || B){
  20.     declaration();
  21.     accept(sym.PyCOMA);
  22. }
  23.  
  24. }
  25.  
  26. void accept(int token_deseado){
  27. if(token_actual.tipo != token_deseado){
  28.     // error
  29. }else {
  30. token_actual = scanner.next_token();
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement