Fermé

implementing a Type checker for AST

In Java, write a type-checker for the language specified by the CFG below, with initial variable E:

E → INT  |  ID  |  (E BINOP E)

| E COMP E  |  BLOCK  |  ID := E

| if E then BLOCK else BLOCK

| while E do BLOCK

| repeat BLOCK until E

BLOCK → { ENE }

ENE → E  |  E; ENE

COMP → ==  |  <  |  >  |  <=  |  >=

BINOP → +  |  −  |  *  |  /

ID → (an identifier)

INT → (an integer)

The type-checker is not responsible for constructing an AST for an expression as above, but may take it as input. It is also not responsible for checking that variables are well-defined where they occur: it is allowed to assume that any variable it encounters is well-defined, and has type Int. Your type-checker should assign types as follows:

It should assign Int to any identifier, integer, or arithmetic expression on values of type Int;

It should assign Bool to any comparison between values of type Int;

It should assign Unit to any if statement or any loop, or to any assignment to an identifier;

It should assign to any BLOCK, the type of the last expression within that BLOCK.

The type-checker should produce a String as output, containing the value "Int", "Bool", or "Unit", as appropriate. The type-checker should throw a TCException if it encounters any of the following:

an expression which either involves comparisons / operations / assignments in which one arguments does not have type Int;

a conditional / loop with a condition which is not of type Bool;

a conditional / loop with a BLOCK expression which is not of type Unit.

In the tests that it will be checks against, it should always terminate correctly or throw a TCException; in particular, it should not simply abort if it encounters some other problem.

Compétences : Java

En voir plus : java write class text file, java write bmi calculator, connect board java write game code, send type file obex java code, implementing payment gateways projects java, java multi language website, encapsulation java bangla language, java write gui program java, java write games, implementing double linked list java, implementing doubly linked lists java, java write file ppm format example, java write instance file ppm format, implementing message board database java, swedish write language, linux java write utf file, java write java face detection proggram, java write program gauge expected cost item specified

Concernant l'employeur :
( 13 commentaires ) Ma On Shan, Hong Kong

Nº du projet : #30868345

6 freelances font une offre moyenne de 1005 $ pour ce travail

pavelfree23

Software development using Java language is my top skill and I really love it. I will do my best for you as I have extremely excited previous clients with my perfect results. As you can see in my profile, I have enoug Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% HKD en 1 jour
(7 Commentaires)
3.4
(5 Commentaires)
3.2
bluestack333

Hi, I've read your description carefully. I have full experience with Java, AST parser I've also worked on several similar projects. So I can complete your project with high quality on time. Looking forward to hear mor Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% HKD en 2 jours
(0 Commentaires)
0.0
sharmaalana1

HI I am experienced in Read our guide etc I can start right now but i have few doubts and questions lets have a quick chat and get it started waiting for your reply

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% HKD en 7 jours
(1 Évaluation)
0.0
alamineee

Hi, Dear Employer, I have read your job post carefully. I have over seven-plus years of experience at the ✔Machine Learning ✔python ✔Matlab ✔C program, ✔C++ program. ✔R program, ✔Algorithm✔java, and others. Please fee Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% HKD en 3 jours
(0 Commentaires)
0.0
AleksandarDikic

Hello JAVA EXPERT I have read your description and I am so interested in your project. You can see well experienced and skillful Java +15 years of experience in software development. Confident in your project and I can Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% HKD en 1 jour
(0 Commentaires)
0.0