项目作者: Shyam-Makwana

项目描述 :
This project is part of the Language Translator Subject. Have created compiler for parsing and evaluating the String, Char and Int based operation.
高级语言: C
项目地址: git://github.com/Shyam-Makwana/String-Char-Int-Compiler.git
创建时间: 2021-04-16T16:02:25Z
项目社区:https://github.com/Shyam-Makwana/String-Char-Int-Compiler

开源协议:

下载


All In One Compiler Project

Click here to view project online.

Project definition

Make a compiler for language described as follows:-
Following is a valid sentence in a string, char and int operation based compiler. Generate its appropriate
language description and compiler

Valid sentences in language :

  • string s;
  • string str = “Shyam”;
  • string str = pqr + xyz;
  • string str = “Shyam” + “Makwana”;
  • char c;
  • char c = ‘S’;
  • int pos = pqr ? xyz;

Grammar for Compiler

  1. START -> EXPR SEMICOLON NEWLINE
  2. EXPR -> 'string' VARNAME STR
  3. | 'char' VARNAME CHAR
  4. | 'int' VARNAME INT
  5. STR -> ASSGN STR1
  6. | ε
  7. STR1 -> VARNAME SOP VARNAME
  8. | "VALUESTR" STR2
  9. STR2 -> SOP "VALUESTR"
  10. | ε
  11. CHAR -> ASSGN CHAR1
  12. CHAR1 -> 'VALUECHAR'
  13. INT -> ASSGN INT1
  14. INT1 -> VARNAME IOP VARNAME
  15. ASSGN -> '='
  16. SOP -> '+'
  17. | '-'
  18. | '<->'
  19. IOP -> '?'

Technologies used

HTML, Js, Ajax, bootstrap, jquery, NodeJS, Express

To Run locally

  • clone the repo
  • run npm install
  • run npm start

alt text