GithubHelp home page GithubHelp logo

make-urprogamminglang's Introduction

Scanner nd Parser of Compiler

My own language is a case sensitive objects oriented . A program consists of class declaration which includes variables declaration and sequence of Methods declarations. Each method consists in turn of variable declarations and statements.

the Back-End of my Language is PHP

Review the token in scanner

I write basics of lang.. rest of some in code

source file of the program Keywords Meaning Return Token
lexical Analyzer Type is the blueprint from which individual objects are created. Class
Infer Inheritance in oop. Inheritance
If—Else conditional statements Condition
Ipok Integer type Integer
Sipok Signed Integer type SInteger
Craf Char type Character
Sequence Group of characters String
However/When repeatedly execute code as long as condition is true Loop
Srap grouped list of variables placed under one name Struct
Scan –Conditionof To switch between many cases Switch

Parser grammar rules(Semantic Analysis)

      1. Program →Start-Symbols ClassDeclaration End-Symbols.
      2. Start-Symbols →@| ^
      3. End-Symbols→$ |#
      4. ClassDeclaration→ Type ID{ Class_Implementation} | Type ID Infer { 
      Class_Implementation}
      5. Class_Implementation→ Variable_Decl Class_Implementation| 
      Method_Decl Class_Implementation | Comment Class_Implementation | 
      require_command Class_Implementation| Func _Call 
      Class_Implementation |em
      6. Method_Decl→ Func Decl ;| Func Decl { Variable_Decl Statements }
      7. Func Decl →Type ID (ParameterList)
      8. Type → Ipok |Sipok |Craf |Sequence |Ipokf |Sipokf |Valueless |Rational
      9. ParameterList →em| None | Non-Empty List
      10. Non-Empty List→ Type ID | Non-Empty List , Type ID
      11. Variable_Decl→ em | Type ID_List ; Variable_Decl | Type ID_List 
      [ID] ; Variable_Decl
      12. ID_List →ID | ID_List , ID
      13. Statements→em | Statement Statements
      14. Statement→Assignment | If _Statement | However _Statement |
      when_Statement | Respondwith _ Statement | Endthis 
      _Statement|Scanvalur (ID ); | Print (Expression); | 
      15. Assignment→ Variable_Decl = Expression;
      16. Func _Call → ID (Argument_List) ;
      17. Argument_List →em | NonEmpty_Argument_List
      18. NonEmpty_Argument_List →Expression | NonEmpty_Argument_List , 
      Expression
      19. Block Statements→{ statements }
      20. If _Statement→ if (Condition _Expression) Block Statements | if 
      (Condition _Expression) Block Statements else Block Statements
      21. Condition _Expression→ Condition |Condition Condition _Op 
      Condition
      22. Condition _Op → && | || 
      23. Condition→ Expression Comparison _Op Expression 
      24. Comparison _Op → == | != | > | >= | < | <=
      25. However _Statement → However (Condition _Expression) Block 
      Statements
      26. when _Statement → when ( expression ; expression ; expression ) Block 
      Statements
      27. Respondwith _Statement→ Respondwith Expression ; | return ID ;
      28. Endthis _Statement→ Endthis;
      29. Expression → Term |Expression Add_Op Term
      30. Add_Op → + | -
      31. Term→Factor| Term Mul_Op Factor 
      32. Mul_Op→* | /
      33. Factor→ ID| Number
      34. Comment →</ STR /> | ***STR
      35. Require_command →Require(F_name.txt);
      36. F_name →STR

Output

input

1- @ Type Person{
2- Rational G() {
3- int frt=5;
4- when (in counter<num){
5- int reg3=reg3-1; } }} $

Scanner_Output

Line : 1 Token Text: @ Token Type: Start Symbol
Line : 1 Token Text: Type Token Type: Class
Line : 1 Token Text: Person Token Type: Identifier
Line : 1 Token Text: { Token Type: Braces
Line : 2 Token Text: Rational Token Type: Boolean
Line : 2 Token Text: G Token Type: Identifier
Line : 2 Token Text: ( Token Type: Braces

Parser_Output

Line : 1 Matched Rule used: Program and ClassDeclaration
Line : 2 Matched Rule used: Func Decl
Line : 3 Not Matched 
Total NO of errors: 1

Contact

You can communicate through following e-mail to get All Src code with web(UI) nd Navigator: [email protected]

make-urprogamminglang's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.