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.
-
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)
- C Programming Language
- GNU Bison (Yacc-style parser)
- Flex (Lexical analyzer)
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
bison -d parser.y
flex lexer.l
gcc lex.yy.c bison.tab.c -o parser -lfl
./parser input_file.xml