Get Solutions for: Create a tokenizer in Ruby. Your tokenizer will take two command line arguments: The first willbe a

Create a tokenizer in Ruby.
Your tokenizer will take two command line arguments: The first willbe a grammar specification and the second will be a file totokenize. Tokenize the file and print the tokens (symbol, lexeme,line) to the screen. If the file cannot be tokenized, print anerror message identifying the line with the error.
NUM -> d+ ADDOP -> [-+] MULOP -> [*/] LP -> ( RP -> ) EQ -> = ID -> [A-Z]w* comment -> {[^}]*}
S -> ID EQ expr expr -> expr ADDOP term | term term -> term MULOP factor | factor factor -> ID | NUM | LP expr RP
4+2 { this is a comment } + 6
1
+
2 *
3
puts grammar = gets.chompfile = File.open(grammar, )lines = Array.newFile.open(grammar).each { | | lines }contents = file.readputs contents grammarContents = file.readputs grammarContents puts tokenize = gets.chompfile = File.open(tokenize, )contents = file.readputs contents tokenizeContents = file.readputs tokenizeContents
. . .