/vyaakaran

📜 Visualize formal languages and automata

Primary LanguageTypeScriptMIT LicenseMIT

Vyaakaran - Visualize formal languages and automata

Features

  • Regular languages.
  • Context free languages.
  • Turing machine simulator.
  • Powerful console with nifty utilities.
  • Completely client-side on the browser.

Project structure

The Vyaakaran project has following three modules:

  • Compiler
    This is the underlying module that powers all the magic behind Vyaakaran! It contains the code for the lexer, parser, analyzer and all the other algorithms for processing regular, context-free grammars, and Turing machines.

    • Built with TypeScript.
    • The package name is @vyaakaran/compiler.
  • Editor
    This is the visual web-based editor which can be accessed at vyaakaran.now.sh/playground. It uses the Compiler module and builds a nice UI over it which helps in writing, visualizing, and testing the grammars and Turing machines in an interactive way.

  • Website
    This is the vyaakaran.now.sh website. It currently highlights Vyaakaran's features, and will be the place for any blog posts and documentation for Vyaakaran.

All the above modules are a part of this monorepo itself under their respective directories. pnpm workspaces is used to manage all the modules.

Local setup

Prerequisites

Following tools must be installed:

Running the dev server

  1. At the root of the project, run:

    pnpm install
  2. To start the dev server of all the modules, run:

    pnpm run dev

    Depending on the module you want to work on, you can only start the dev server of that particular module by running its corresponding command:

    • compiler: pnpm run compiler:dev
    • editor: pnpm run editor:dev
    • website: pnpm run website:dev
  3. The dev server should start running. To view the changes for:

    • compiler: Modify compiler/src/playground.ts file and run pnpm run playground inside compiler directory.
    • editor: Open localhost:3000.
    • website: Open localhost:3001.

Building for production

To build all the modules, run:

pnpm run build

Running the above command will produce following artifacts:

  • compiler/dist/ will contain the built @vyaakaran/compiler package.
  • build/playground/ will contain the built Vyaakaran editor.
  • build/ will contain the rest of Vyaakaran website.

If you want to build only some of the modules, run its corresponding command:

  • compiler: pnpm run compiler:build
  • editor: pnpm run editor:build
  • website: pnpm run website:build

License

Vyaakaran is MIT Licensed