https://github.com/pereirar3/compiler-java
Java compiler to read script written in Pascal
https://github.com/pereirar3/compiler-java
compiler java
Last synced: 3 months ago
JSON representation
Java compiler to read script written in Pascal
- Host: GitHub
- URL: https://github.com/pereirar3/compiler-java
- Owner: pereiraR3
- Created: 2025-05-26T00:44:10.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-06-05T17:53:09.000Z (4 months ago)
- Last Synced: 2025-06-05T18:42:16.877Z (4 months ago)
- Topics: compiler, java
- Language: Java
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lexical Analyzer Compiler - Pascal Language
This repository contains a lexical analyzer implemented in Python as part of an academic project for the **Compilers** course. The goal of this activity was to develop a simple **compiler using only lexical analysis techniques**, capable of processing a Pascal-like language.
## ๐ Project Objective
The main objective of this activity is to implement a lexical analyzer that processes a source code written in Pascal (stored in `Programa_fonte.txt`), identifying:
- Reserved keywords (e.g., `program`, `var`, `begin`, `end`)
- Assignment operators (`:=`)
- Identifiers (IDs)
- Type declarations (e.g., `integer`, `real`)
- Symbols (e.g., `;`, `:`, `=`, `+`, `(`, `)`)All tokens must be stored in a **symbol table**, and any lexical **errors must be identified and reported individually**, including but not limited to:
- Unrecognized identifiers
- Invalid keywords
- Misspelled reserved words
- Missing or unexpected symbolsThe analyzer continues processing until **all errors are found** and **reported clearly** in the output.
## ๐งช Input Example
Sample input (from `Programa_fonte.txt`):
```pascal
progra Soma;var
x,y,z: intege;
begi
y=1;
z=1;
i=0;
x:=y+z+i;
writeln (x);
end.