Skip to content

This is a simple lexical analyzer for the programming language PL/0. The program reads in a source program written in PL/0, identifies tokens, and produces an output that includes the source program, the source program lexeme table, and the token list.

Notifications You must be signed in to change notification settings

EdwardR2023/PL-0_Compiler_Pt2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PL/0 Lexical Analyzer

Description

This is a simple lexical analyzer for the programming language PL/0. The program reads in a source program written in PL/0, identifies tokens, and produces an output that includes the source program, the source program lexeme table, and the token list.

Features

  • Supports tokens for identifiers, numbers, and symbols specified in the PL/0 language.
  • Handles keywords such as begin, end, if, while, etc.
  • Detects lexical errors such as identifier or number length exceeding the maximum allowed, and invalid symbols.
  • Ignores comments and invisible characters in the input file.

Usage

  1. Compile the program using a C compiler.
  2. Run the compiled executable, providing the input file containing the PL/0 source code.
  3. The program will generate the token list as output.

Input Format

The input file should contain the PL/0 source code. Compile with gcc lex.c ./a.out input.txt

About

This is a simple lexical analyzer for the programming language PL/0. The program reads in a source program written in PL/0, identifies tokens, and produces an output that includes the source program, the source program lexeme table, and the token list.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published