Giter Site home page Giter Site logo

lexical-analyzer's Introduction

JavaScript Lexical Analyzer

Overview

This repository contains a simple Lexical Analyzer implemented in JavaScript for JavaScript code. The purpose of this tool is to break down the input JavaScript code into individual tokens, providing a foundational step in the process of building a compiler or interpreter.

Additionally, the project includes HTML and CSS components for a user-friendly interface to visualize the output of the Lexical Analyzer.

Features

  • Lexical Tokenization: The analyzer breaks down the input JavaScript code into tokens, such as keywords, identifiers, literals, and operators.

  • Configurable: Easily configure the analyzer to include or exclude specific types of tokens based on your needs.

  • Output Formatting: The tool produces a structured output, making it easier to understand and work with the generated tokens.

  • User Interface: The project includes HTML and CSS components for a table-based interface to display the token information.

Getting Started

Follow these steps to use the JavaScript Lexical Analyzer in your project:

  1. Clone the Repository:

    git clone https://github.com/pardis-mdd/lexical-analyzer.git
  2. Include the Analyzer and UI files:

    • Copy the lexicalAnalyzer.js, index.html, and styles.css files into your project.
    • Include the files in your HTML file.
      <script src="path/to/lexicalAnalyzer.js"></script>
      <link rel="stylesheet" type="text/css" href="path/to/styles.css">

Token Types

The Lexical Analyzer recognizes the following token types:

  • Keyword
  • Identifier
  • Literal
  • Operator
  • Punctuation

output columns

The output table is designed to present the analyzed tokens in a clear and organized manner. It includes the following columns:

  1. Type
  2. Value
  3. Line
  4. Index
  5. Block

Testing

Included in this repository is a sample JavaScript file, test.js, that you can use to test the Lexical Analyzer. Modify and experiment with the contents of test.js to observe how the analyzer processes different JavaScript code structures. Use this testing script to ensure the correct functionality of the lexical analysis process in various scenarios.

lexical-analyzer's People

Contributors

pardis-mdd 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.