Skip to content

This project aims to develop a custom lexer and parser in Python using PLY (Python Lex-Yacc) to validate common syntax in the Java programming language.

Notifications You must be signed in to change notification settings

dudesoccer123/JAVA-Syntax-Validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JAVA-Syntax-Validator

This project aims to develop a custom lexer and parser in Python using PLY (Python Lex-Yacc) to validate common syntax in the Java programming language.

Features

  • Custom Lexer: Tokenizes input Java code according to defined regular expressions.
  • Custom Parser: Parses tokenized input according to specified grammar rules to validate syntax.
  • Modular Design: Easily extendable for adding more syntax validations.

Installation

  1. Clone this repository:

    git clone https://github.com/your_username/java-syntax-validator.git
  2. Install the required Python packages:

    pip install ply

Usage

Running the Array Declaration Syntax Validation

  1. Navigate to the project directory.

  2. Run the following command:

    python code_array.py
  3. Enter a sample array declaration statement when prompted, e.g. int[] arr = new int[50];.

  4. The program will output whether the input statement is a valid Java array declaration or not.

Running Other Syntax Validations

  1. Repeat steps 2-4 from the above section, replacing code_array.py with the corresponding validator script (e.g., code_construct.py).

Note: This project is intended for educational purposes and may not cover the full spectrum of Java syntax. Use at your discretion.

About

This project aims to develop a custom lexer and parser in Python using PLY (Python Lex-Yacc) to validate common syntax in the Java programming language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages