Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. interpreter = function( codeList, scope )
  2. {
  3. while( codeList.hasNextInstruction() )
  4. {
  5. instr = codeList.next() ;
  6.  
  7. switch (instr )
  8. case '='
  9. expression = interpreter( instr.expression ) ;
  10.  
  11. if( instr.var.type != expression.type )
  12. {
  13. this.typeViolation() ; // function calls can be listened too
  14. return ;
  15. }
  16. case 'function'
  17. if( function.unitTest ) interpreter( function.unitTest, scope )
  18.  
  19. case default // ie. +, - etc
  20. for( i in instr ) interpreter( i, scope ) ;
  21. instr() ;
  22. }
  23.  
  24. }
  25.  
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement