Em Andamento

Scanner

Write a Complete compiler for a small language (implemented in C) The language for the project is a hybrid of C++ and Java. A program will consist of just one class, as a wrapper for the program. Code will be strictly procedural with no object instantiation. Class components will be public. Class will inherit from a common class Object (as in Java) but there will be no other inheritance Phase 1 is the scanner: Each call to the scanner should return the next token along with its value if needed. Also record the line number and starting character position on the line of each token. This is useful for error reporting. The input should be read from a text file. A driver program should be written that takes the input file name as a command line parameter and prints a list of tokens, their values, and their location in the input text. Compiler Project: Preliminary Specification The source language for the compiler project has elements derived from both C++ and Java but considerably simplified from both. It will be referred to as CJ--. You may choose the implementation language and tools for building the compiler. The implementation environment must be either Unix/Linux or MS Windows. The target language will be a much-restricted version of C++ to be run on either Unix systems or MS Windows.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.

3) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).

Lexical Conventions · The ASCII character set will be used. · Comments and whitespace will be ignored except that they serve as separators for other language components o Comments begin with // and run to the end of the line o Whitespace characters are space, tab, carriage return, and newline · The main classes of tokens are Identifier, Reserved Word, Literal, Separator, and Operator · Line terminators in source code will depend on implementation platform Tokens · Basic Keywords: cin class cout else float if int return void while · Additional Keywords: boolean break continue false new null this true · Basic Special characters: + - * / % ! = , < > ( ) { } == != << >> ; · Additional Special characters: || && <= >= . · Indentifier : The regular definition for the identifier is: identifier: letter (letter | digit)* letter: [A-Z]|[a-z]|_ digit: [0-9] · Integer literal : The following is regular definition for integer numbers in CJ--: integer_num: digit (digit)* digit: [0-9] · Floating-point literal : The following regular definition is for floats in CJ--: float_num: digit*fraction exponent? | digit+. | digit+.?exponent digit: [0-9] fraction: .digit+ exponent: (E|e)(+|-)?digit+ · String literal : The following is regular definition for strings in CJ--: string_literal: quote non_quote_char* quote quote: " non_quote_char: [^"]|\"|\n · Boolean literal : The following is regular definition for strings in CJ--: boolean_literal: true | false · Null literal : The following is regular definition for strings in CJ--: null_leteral: null Program Structure The following are the grammar rules in EBNF for CJ--: These are the CJ-- statements: · program: class_decl+ · class_decl: class identifier class_def · class_def: '{'decls+'}' · decls: decl decl* · decl: function_decl | var_decl · function_decl: type_specifier identifier '('param_decl_list')' compound_st · param_decl_list: param_decl(',' param_decl)* · type_specifier: 'int'| 'float' | 'boolean' | 'void' | identifiertype · param_decl: type_specifier identifier · compound_st: '{'(var_decl* statement+)? '}' · var_decl: type_specifier var_decl_list';' · var_decl_list: variable_ident(',' variable_ident)* · variable_ident: identifier('=' expression)? · statement: compound_st | conditional_st | while_st | 'break' ';'| 'continue' ';' | 'return' expression ';' | expression? ';' | io_stmt · conditional_st: 'if' '('expression')' statement ('else' statement )? · while_st: 'while' '(' expression ')' statement · io_stmt: 'cin' '>>' element_access ';' | 'cout' '<<' expression ';' Below are the types of expressions in CJ--. Each of these carries a value of one of the allowed CJ-- types (int, float, or boolean). · expression: identifier '='expression | condition · condition: disjunction · disjunction: conjunction | disjunction '||' conjunction · conjunction: comparison | conjunction '&&' comparison · comparison: relation | relation ('==' | '!=') relation · relation: sum | sum ('<' | '<=' | '>' | '>=')

## Platform

The implementation environment must be either Unix/Linux or MS Windows. cont. sum · sum: term | sum ('+' | '-') term · term: factor | term ('*' | '/') factor · factor: cast | ('!' | '-') factor · cast: '(' type_specifier ')' identifier | primary . primary: literal | element_access | class_instance_creation | method_invocation | '(' expression ')' · literal: integer_num | float_num | string_literal | boolean_literal | null_literal · element_access: identifier | primary '.' identifier · clsss_instance_creation: 'new' identifiertype '(' arguments ')' · arguments: expression+ · method_invocation: method_call | primary '.' method_call · method_call: identifiermethod '(' arguments ')' Note: Some aspects of CJ-- are borrowed from C-- designed by Bill Waite (UC Boulder) and Lynn Carter (CMU) and used as the project for the undergraduate compiler-writing course at Colorado State University.

Habilidades: Programação C, Engenharia, Linux, Microsoft, MySQL, PHP, Arquitetura de software, Teste de Software, UNIX, Área de trabalho do Windows

Ver mais: writing to a file java, writing to a file in java, writing expressions, writing conventions definition, writing conventions, writing a to z, writing a programming language, writing a compiler, writing a character letter, writing a bill, wrapper programming, work in colorado, whitespace programming language, unix systems programming, unix programming language, unix programming environment, university of colorado boulder, types of programming language, types of arguments in writing, tools needed for programming, tools needed for java programming, tools for php programming, systems programming language, strings in c programming, string regular expression java

Acerca do Empregador:
( 16 comentários ) United States

ID do Projeto: #2979969

Premiar a:

aoavw

See private message.

$21.25 USD em 4 dias
(8 Avaliações)
1.8

5 freelancers estão ofertando em média $226 para este trabalho

esegura

See private message.

$21.25 USD in 4 dias
(22 Comentários)
4.8
shashikhanvw

See private message.

$850 USD in 4 dias
(15 Comentários)
3.8
MImre

See private message.

$25.5 USD in 4 dias
(36 Comentários)
3.6
fahadj

See private message.

$212.5 USD in 4 dias
(1 Comentário)
0.0