@panini-bhasha/core

Panini - the Indian programming language.

Usage no npm install needed!

<script type="module">
  import paniniBhashaCore from 'https://cdn.skypack.dev/@panini-bhasha/core';
</script>

README

Panini - Indian programming language

Requirements for using Panini compiler

  1. NodeJS (version >= 16.0.0)
  2. npm (version >= 7.18.1)

Using Panini compiler

  1. Install with the following command
$ npm install -g @panini-bhasha/core
  1. Usage
$ panini <file name>

Requirements and setup for contributing to Panini

  1. NodeJS (version >= 16.0.0)
  2. npm (version >= 7.18.1)
  3. TypeScript (version >= 4.4.2)
    Install with the following command
$ npm install -g typescript
  1. Jasmine (version >= 3.9.0) Install with the following command
$ npm install -g jasmine
  1. After cloning the repo run the following command to install all devDependencies
$ cd panini-clone-location
$ npm install

Adding support for new Indian language

  1. Create a branch and check it out. Make sure your working branch (existing or newly created) has the latest changes from main before making any changes.
  2. Add language to src/language.ts
  3. Create file with language's name under src/rules directory. For example, to add support for the తెలుగు (Telugu) language, create file src/rules/తెలుగు.ts.
    Note: the file's name should match with the enum added in step 1.
  4. Add the syntax rules in the file created above. Rules map should be named like <language>_RulesMap. For తెలుగు it would be named తెలుగు_RulesMap.
    Note: be careful to add the rule for TokenType.ModuleStart such that it creates well-known action and goto table entries. Read the parse function's comments in src/parser.ts for more details.
  5. Import the rules created above in src/rules.ts
  6. Export the rules created above from src/index.ts
  7. Add rules created above to src/firstSet.ts
  8. Add token generation to src/lexer.ts and token types to src/token/tokenType.ts.
  9. Add appropriate syntax error messages in src/errors/syntaxError.ts and semantic analysis steps in src/parser.ts
  10. Add correct steps for transpilation under src/transpiler.ts
  11. Run tests.
$ npm test
  1. Add thorough tests in the required spec.ts files and verify no existing tests are broken. Create new test files if required. New test files are most likely required for changes made to parser.ts and transpiler.ts
  2. Make sure all the tests pass. AGAIN.
  3. Sync your working branch with main branch AGAIN before committing any code. To allow GitHub to automatically link an issue to a commit and help us in tracking why a particular change was done, commit message should be of the format
$ git commit -m "Issue #<issue number>: <message>"
  1. Do NOT push changes directly to main branch.
  2. Submit a pull request to the main branch.