{"id":21270681,"url":"https://github.com/truongd3/new_perl-like_language","last_synced_at":"2026-05-17T21:08:22.280Z","repository":{"id":150948561,"uuid":"623315121","full_name":"truongd3/New_Perl-Like_Language","owner":"truongd3","description":"New Simple Perl-Like Language by Truong Dang","archived":false,"fork":false,"pushed_at":"2023-07-07T13:46:19.000Z","size":115,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T02:31:52.478Z","etag":null,"topics":["cpp","data-structures","perl"],"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/truongd3.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-04-04T06:04:38.000Z","updated_at":"2024-06-23T02:22:03.000Z","dependencies_parsed_at":"2024-06-19T09:25:59.252Z","dependency_job_id":"c4f9375e-71a2-4968-af57-007717386cb4","html_url":"https://github.com/truongd3/New_Perl-Like_Language","commit_stats":null,"previous_names":["truongd3/new_perl-like_language"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truongd3%2FNew_Perl-Like_Language","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truongd3%2FNew_Perl-Like_Language/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truongd3%2FNew_Perl-Like_Language/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/truongd3%2FNew_Perl-Like_Language/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/truongd3","download_url":"https://codeload.github.com/truongd3/New_Perl-Like_Language/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243725636,"owners_count":20337670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cpp","data-structures","perl"],"created_at":"2024-11-21T08:18:16.999Z","updated_at":"2026-05-17T21:08:22.274Z","avatar_url":"https://github.com/truongd3.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# New Perl-Like Language\n*New Simple Perl-Like Language by [Truong Dang](https://youtu.be/WhOarQhY8FI)*\n\n## Contributors:\n- [Truong Dang](https://www.linkedin.com/in/2dt/)\n- [Dr. Bassel Arafeh](https://scholar.google.com/citations?user=JYGNtvIAAAAJ\u0026hl=en)\n- [Hessamaldin Mohammadi](https://www.linkedin.com/in/hessam-mohammadi-a3633976/)\n\n## Language Definition:\n\n### Lexical Analyzer\n\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\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-Descent Parser\n\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. PrimaryExpr ::= IDENT | SIDENT | NIDENT | ICONST | RCONST | SCONST | (Expr)\n```\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 syntax analysis of the input source code statement by statement, then execute the stamte if there is no error.\n  - Build information of variables types in the symbol table for all defined variables.\n  - Evaluate expressions and determine values and types.\n\n## Tech Stack\n\n- Coding language: C++ (version 11+)\n- Libraries/Frameworks: `string`, `queue`, `map`, `iomanip`, `stdexcept`, `cmath`, `sstream`, `iostream`, `ctime`, `iomanip`, `filesystem`\n\n## How to Run:\n\n- Clone this repo to your local IDE (VSCode)\n\n### Regular Testing\n\n```bash\ng++ -std=c++11 problem.cpp parserInt.cpp lex.cpp -o problem\n```\n\n### Analyze Running\n\n```bash\ng++ -std=c++11 analyzer.cpp parserInt.cpp lex.cpp -o analyzer\n```\n\nThen navigate [output/analyzer_report.txt](output/analyzer_report.txt) to see the updated result.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruongd3%2Fnew_perl-like_language","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftruongd3%2Fnew_perl-like_language","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftruongd3%2Fnew_perl-like_language/lists"}