Analysis of Programming Language iag0450 Exam 2016



Download 11.45 Kb.
Date13.05.2017
Size11.45 Kb.
#17906
Analysis of Programming Language IAG0450 Exam 2016(50p,with test)

A.Theoretical part 25p

Syntax diagram and description in metalanguage

The grammar

Type of translators

Translation and interpretation

Multi-level languages

Evaluation of programming language

Desirable characteristics

Essential characteristics

The scanner

The parser

The code generator and optimization

Error handling

General expressions

Assigment statements

IF statement

GO-TO statement

The loop statements



Data types and variables

Meaning of parentheses

The stack as a programming tools

Structured programming

Subroutines

Built-in functions

User-defined functions

http://groups.engin.umd.umich.edu/CIS/course.des/cis400/

Whats the difference between ANTLR4 and Bison grammar parsing? ( LL(*) vs LALR )

Describe the compilation process from a higher level language, e.g. C, to machine code that runs on some processor.

B.Praxis part 25p

1.Write Flex rules for( define token) INT, DOUBLE,VAR and yylval:



%union{

  int intval;

  double doubleval; 

  char *name;





2.We have Flex rules:

digit [0-9]

alpha [a-zA-Z]

alphanum [0-9a-zA-Z]

%%

"PROCEDURE" { return PROC; }

"PRINT" { return PRINT;}

{digit}+ { /*täidetakse yylval*/ return INT;}

{alpha}{alphanum}* { /*täidetakse yylval*/ return VAR;}

[=;{}()+-/*] { return yytext[0];}

[ \t\n] {;} 

and source



PROCEDURE Arvuta ( x )

{

y = x * x - 5;

PRINT y;

}

Write and explane the tokens sequence for this.



3.We have token VAR and Bison rules:

vars: VAR { $$ = push(id($1)); free($1); }

| VAR vars { $$ = push(id($1)); free($1); } 

;

and source a f c g

Descibe translater work.

4.Write ANTLR4 grammar, which accepts playlist file format (*.pls). For example, it should be able to parse the following input:

[playlist]

NumberOfEntries=2

File1=./18 - hammer smashed face.mp3

Title1=Cannbial Corpse - Hammer Smashed Face

Length1=120

File2=http://icecast.err.ee/raadio2.mp3

Title2=Raadio 2



Length1=-1

Version=2

Download 11.45 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page