Analysis of Programming Language iag0450 Exam 2016

Download 11.45 Kb.
Size11.45 Kb.
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


Built-in functions

User-defined functions

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:


  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;



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:



File1=./18 - hammer smashed face.mp3

Title1=Cannbial Corpse - Hammer Smashed Face



Title2=Raadio 2



Download 11.45 Kb.

Share with your friends:

The database is protected by copyright © 2022
send message

    Main page