Guest User

GneralInst

a guest
May 22nd, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const generalInstruction = (mnemonic, type, ...params) =>
  2.     A.coroutine(function* () {
  3.         yield upperOrLowerStr(mnemonic);
  4.  
  5.         const args = [];
  6.  
  7.         if (params.length > 0) {
  8.             yield A.whitespace;
  9.             yield params[0];
  10.         }
  11.  
  12.         for (let i = 1; i < params.length; i++) {
  13.             yield A.optionalWhitespace;
  14.             yield A.char(',');
  15.             yield A.optionalWhitespace;
  16.  
  17.             args.push(yield params[i]);
  18.         }
  19.  
  20.         yield A.optionalWhitespace;
  21.  
  22.         return T.instruction({
  23.             instruction: type,
  24.             args,
  25.         });
  26.     });
  27.  
  28. const litReg = (mnemonic, type) =>
  29.     generalInstruction(
  30.         mnemonic,
  31.         type,
  32.         A.choice([hexLiteral, squareBracketExpr]),
  33.         register
  34.     );
Advertisement
Add Comment
Please, Sign In to add comment