Skip to content

kgzach/Android-XML-Layout-Parser-with-Bison-Flex-C-

Repository files navigation

Android XML Layout Parser with Bison & Flex (C)

Principles-of-Programming-Languages-and-Compilers Course

CEID, University of Patras.

XML Layout Parser Using Bison & Flex

📌 Project Overview

This project is a custom XML-like layout parser developed as part of the
Principles of Programming Languages and Compilers course at CEID, University of Patras.

It is implemented in C using GNU Bison (parser generator) and Flex (lexical analyzer).

The parser is designed to validate and process simplified Android-style XML layout files.


⚙️ Features

  • Parsing of Android-like UI layout elements:

    • LinearLayout
    • RelativeLayout
    • TextView
    • ImageView
    • Button
    • RadioGroup / RadioButton
    • ProgressBar
  • Attribute validation:

    • layout_width / layout_height constraints
    • padding validation
    • progress range checking
  • Structural checks:

    • Unique ID validation
    • RadioGroup consistency checks
    • Required attribute enforcement
  • Comment support (<!-- --> style)


🧠 Technologies Used

  • C Programming Language
  • GNU Bison (Yacc-style parser)
  • Flex (Lexical analyzer)

📂 Project Purpose

The goal of this project is to simulate a compiler-like system that:

  • Tokenizes XML-like input
  • Parses layout structure
  • Validates semantic rules
  • Detects errors in UI definitions

🚀 How to Build & Run

bison -d parser.y
flex lexer.l
gcc lex.yy.c bison.tab.c -o parser -lfl
./parser input_file.xml

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors