+ 1
JfLex
A Monkie2004 program is made up of a sequence of lexemes, each of which can be classified as being of one particular token type. Unless otherwise specified, the lexeme that should be returned by your scanner is the actual chunk of source text, such as 35 or <-. The types of tokens, and the rules that govern their appearance, are as follows: ļ· Identifiers must begin with an uppercase or lowercase letter, followed (optionally) by any number of uppercase letters, lowercase letters, digits, or underscores ('_'
6 Answers
+ 2
Sorry but I don not use Facebook. You can post your full question here so that everyone present here can help you. Trust me, this community is extremely helpful.
+ 1
Thanks for the piece of information.
+ 1
if you give me name for you in Facebook I will give you full question please help me I need solution
+ 1
OK thank you very much
+ 1
Introduction The first step of compilation is scanning (sometimes called lexical analysis). As we discussed in class, the objective of scanning is to take the source program, which is in reality a stream of characters, and turn it into a stream of lexemes, or words, instead. This raises the level of abstraction of the source program at a very low cost, since scanning can be done very efficiently. The time spent on scanning pays off many times over, as the next step of compilation, parsing, has a much higher cost per symbol than scanning does. The fewer symbols a parser deals with, the less time and memory is used, so a compiler is much more efficient if its parser deals with lexemes rather than characters.
In this assignment, you'll write a scanner for a hypothetical language called Monkie2004. You'll be using a Java-based scanner generator called JFlex for the majority of your solution to this assignment.
The Monkie2004 language
The Monkie2004 language is a simple imperative-style language with two basic data types (integers and strings), functions with zero or more arguments and one return type, procedures with zero or more arguments and no return type, reasonably straightforward mathematical, relational, and logical operations, and a few kinds of imperative-style statements (e.g. assignment statements, an "if" statement, and one kind of loop). Of course, to build a scanner, it's not necessary to know the complete specification of a programming language (though, in some cases, it helps), so I will stick to a brief example program and a lexical specification (i.e. what each kind of token looks like, without regard for how these tokens are put together to write a Monkie2004 program).
0
I need solution please