{"id":20846521,"url":"https://github.com/agrvanshika/parser-for-perl-like","last_synced_at":"2026-04-27T07:33:20.661Z","repository":{"id":165281532,"uuid":"640612664","full_name":"AgrVanshika/Parser-for-Perl-like","owner":"AgrVanshika","description":"Parser for a Perl-like-language given the EBNF notation","archived":false,"fork":false,"pushed_at":"2023-05-14T18:22:54.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T17:36:48.967Z","etag":null,"topics":["ebnf-syntax","parser","perl-lang"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AgrVanshika.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-14T17:02:07.000Z","updated_at":"2023-05-14T18:32:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"52289e40-726a-48b8-ac66-ead7852a60de","html_url":"https://github.com/AgrVanshika/Parser-for-Perl-like","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AgrVanshika/Parser-for-Perl-like","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgrVanshika%2FParser-for-Perl-like","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgrVanshika%2FParser-for-Perl-like/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgrVanshika%2FParser-for-Perl-like/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgrVanshika%2FParser-for-Perl-like/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AgrVanshika","download_url":"https://codeload.github.com/AgrVanshika/Parser-for-Perl-like/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AgrVanshika%2FParser-for-Perl-like/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32327701,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ebnf-syntax","parser","perl-lang"],"created_at":"2024-11-18T02:16:44.680Z","updated_at":"2026-04-27T07:33:20.637Z","avatar_url":"https://github.com/AgrVanshika.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parser-for-Perl-like\nSimple-Perl-Like Language\n\n## Language definition\n\n### Lexical Analyser\n- The syntax definitions of this Perl-like language are given below using [Extended Backus–Naur form (EBNF)](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form) notations:\n\n| Usage      | Notation |\n| ----------- | :-----------: |\n| a character *x* |\tx |\n| an escaped character | \\x |\n| M followed by N | MN |\n| **zero or more** occurrences of M | M* |\n| **one or more** occurrences of M | M+ |\n| **zero or one** occurrence of M | M? |\n| definition | = |\n| termination\t| ; |\n| alternation |\t\\| |\n| optional |\t[ ... ] |\n| repetition |\t{ ... } |\n| grouping |\t( ... ) |\n| terminal string |\t' ... ' |\n| exception |\t- |\n\n- Identifiers (**IDENT**)\n  - **IDENT** := [ Letter _ ] {( Letter | Digit | _ )}\n  - Letter := [ a-z A-Z ]\n  - Digit := [0-9]\n  \n- The variables are either numeric or string scalar variables. Numeric variables start by \"$\" while a string variables start by \"@\". Both are followed by an IDENT.\n  - **NIDENT** := $ IDENT\n  - **SIDENT** := @ IDENT\n  \n- Integer constants (**ICONST**)\n  - **ICONST** := [0-9]+\n  \n- Real constants (**RCONST**)\n  - **RCONST** := ([0-9]+)\\.([0-9]*)\n  \n- String constants (**SCONST**)\n  - **SCONST** := \\'[anything]+\\'\n  \n- Reserved words: *writeln*, *if*, and *else*\n  - Tokens, respectively: **WRITELN**, **IF**, **ELSE**\n  \n- Terminals: semicolon, comma, left parenthesis, right parenthesis, left braces, and right braces\n  - Tokens, respectively: **SEMICOL**, **COMMA**, **LPAREN**, **RPAREN**, **LBRACES**, and **RBRACES**\n  \n- Comment is defined by anything following “#” to the end of line and does not have a token\n\n- Operators: +, -, *, /, ^, =, ==, \u003e, \u003c, . (dot), ** (repeat), -eq (string equality), -lt (string less than), and -gt (string greater than)\n  - Tokens, respectively: **PLUS**, **MINUS**, **MULT**, **DIV**, **EXPONENT**, **ASSOP**, **NEQ**, **NGTHAN**, **NLTHAN**, **CAT**, **SREPEAT**, **SEQ**, **SLTHAN**, and **SGTHAN**\n  \n- Error (**ERR**)\n\n- End of file (**DONE**)\n\n### Recursive-Desecent Parser\n- Definition (using recursion):\n\n```\n1. Prog ::= StmtList\n2. StmtList ::= Stmt ;{ Stmt; }\n3. Stmt ::= AssignStme | WriteLnStmt | IfStmt\n4. WriteLnStmt ::= writeln (ExprList)\n5. IfStmt ::= if (Expr) ‘{‘ StmtList ‘}’ [ else ‘{‘ StmtList ‘}’ ]\n6. AssignStmt ::= Var = Expr\n7. Var ::= NIDENT | SIDENT\n8. ExprList ::= Expr { , Expr }\n9. Expr ::= RelExpr [(-eq|==) RelExpr ]\n10. RelExpr ::= AddExpr [ ( -lt | -gt | \u003c | \u003e ) AddExpr ]\n11. AddExpr :: MultExpr { ( + | - | .) MultExpr }\n12. MultExpr ::= ExponExpr { ( * | / | **) ExponExpr }\n13. ExponExpr ::= UnaryExpr { ^ UnaryExpr }\n14. UnaryExpr ::= [( - | + )] PrimaryExpr\n15. Primary ::= IDENT | SIDENT | NIDENT | ICONST | RCONST | SCONST | (Expr)\n```\n- Table of Operators Precedence Levels:\n\n| Precedence | Operator | Description | Associativity |\n| :-----------: | :-----------: | :-----------: | :-----------: |\n| 1 |\tUnary + , - | Unary plus and minus | Right to Left |\n| 2 |\t^ | Exponent | Right to Left |\n| 3 |\t\\*, /, \\*\\* | Multiplication, Division, and String repetition | Left to Right |\n| 4 |\t+, -, . (Dot) | Addition, Subtraction, and String concatenation | Left to Right |\n| 5 |\t\u003c, \u003e, -gt, -lt | - Numeric Relational\u003cbr\u003e - String Relational | no cascading |\n| 6 |\t==, -eq | - Numeric Equality\u003cbr\u003e - String Equality | no cascading |\n\n### Interpreter\n\n- Implement `Value` class member functions and overloaded operators from `val.h`\n\n- The **interpreter** provides:\n  - Perform the syntax analysis of the input source code, statement by statement, then execute the statement if there is no error.\n  - Build the information of the variables types in the symbol table for all the given defined variables.\n  - Next, evaluate the expressions and determine the corresponding values and types.\n\n## How its built:\n\n- Coding language: C++\n- Libraries/Frameworks: `string`, `queue`, `map`, `iomanip`, `stdexcept`, `cmath`, `sstream`, and `iostream`\n\n## How to run:\n\n- Clone this repo to your local IDE (VSCode/CLion).\n- Run `prog3.cpp` by command line (including the testcase file name).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrvanshika%2Fparser-for-perl-like","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagrvanshika%2Fparser-for-perl-like","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagrvanshika%2Fparser-for-perl-like/lists"}