Devam Ediyor

344605 Pascal-like language interpr.

Flex,Bison,C language and Linux . Pascal like language interpreter

It's an academic assignment for creating a Pascal-like language interpreter and has

two parts:

1. Development of a lexical analyzer using Flex

2. Development of a syntax analyzer using Bison

Unfortunately the grammar of the language is not given nor the actions for each grammar rule. You can have as basis the Pascal grammar but it's going to need modification to work correctly.

I attach files of given FiP programs. The interpreter must run successful the given programs and must return a correct result.

Here is a bried description of language tokens:

Let us name our new language Fictional Pascal (FiP). It has common parts with traditional Pascal and also some differences.

The FiP language has the following tokens:

1. Key words:

and array boolean char

div do else for

function goto if integer

mod not of or

procedure program real repeat

result return then until

var while to downto

There is no difference between uppercase and lowercase characters.

2. Identifiers e.g. x y1 angle my_value Distance_02

3. Constants (integers)

4. Modifiers:

[]numeric: + - * / div mod ++ --

[]: -eq -gt -lt -dt -ge -le

logical: and or not

[]: :=

5. Dividers

{ } ; ( ) : , [ ] .


7. Line comments : start always with char #

9. Data types:

integer :

boolean :

char :

real :

10. Arrays:

array [n] of t

array [n]…[k] of t:

11. Variables, for example:

var i: integer;

x, y: real;

var s: array [80] of char;

12. Procedures and functions (just like Pascal)

procedure p2 (n: integer);

procedure p3 (a, b: integer; b: boolean);

function f1 (x: real): real;

function f2 (s: array of char): integer;

function f3 (x: real): array [10] of real;

13. Build in functions:


writeString(s: array of char);


writeInteger(j: integer);

14. Expressions:


++ --

+ -

* / div mod

+ -

-eq –lt –le

-dt -gt –ge



The lexical file is given by me but need some modification to work with all tokens:

Deliverables of the project:

1. mylexer.l : the Flex file

2. myanalyzer.y: [url removed, login to view]

3. mycompiler: The executable of the interpretter

4. [url removed, login to view]:

5. [url removed, login to view]: 2 correct programms of FiP

6. [url removed, login to view]: 2 programms of FiP

The first deliverable it must be given among with an executable (it's already made by me in the given lexer file). The executable will take as an input a program of FiP and give as output it's tokens:


define my2pi (2*3.14)

theta := my2pi – theta;


token IDENTIFIER: theta

token ASSIGNMENT: :=




token REAL_CONSTANT: 3.14



token IDENTIFIER: theta

token SEMICOLON: ;

The compiler of the deliverables it's not really a compiler, it's an interpreter. It must take as input a FiP program and give as output the result of it's commands or syntax errors (if the program has syntax errors). For example if the wrong input has a command:

i := k + 2 * ;

the program must give output:

Syntax error in line 56: i := k + 2 * ;


Syntax error in line 56: i := k + 2 * ; (expression expected)

Beceriler: Her şey Kabul, C Programlama, PHP

Daha fazlasını görün: flex bison pascal, bison file pascal, language pascal, using expressions, types of programming language, types of programming errors, theta programming, the first programming language, the c++ programming language pdf, the c programming language pdf, syntax programming, syntax in programming, s programming language, real integers, real expressions, programs in c language, programming with c language, programming variables, programming syntax, programming language types, programming language syntax, programming language c++ pdf, programming language and it, programming expression, programming errors

İşveren Hakkında:
( 3 değerlendirme ) Salonica, Greece

Proje NO: #2090425



Hi, Thanks for the invitation.

8 gün içinde 350$ USD
(96 Değerlendirme)