This project implements a simple language parser for a custom hardware description language using lex/yacc (flex/bison). The parser validates the syntax and semantics of input files according to specified language rules.
- Case-insensitive language processing
- Entity and architecture pair validation
- Signal declaration and assignment checking
- Type compatibility verification
- Comprehensive error reporting
- Linux operating system
- Flex (lex)
- Bison (yacc)
- GCC compiler
- Make utility
-
Clone this repository:
git clone https://github.com/yourusername/simple-language-parser.git cd simple-language-parser -
Ensure you have all the required tools installed. On Ubuntu or Debian-based systems, you can install them with:
sudo apt-get update sudo apt-get install flex bison gcc make -
Build the parser:
make parser
-
Create an input file with your hardware description language code. For example,
input.txt:ENTITY myentity IS END; ARCHITECTURE myarch OF myentity IS SIGNAL s1 : t1; SIGNAL s2 : t1; BEGIN s1 <= s2; END; -
Run the parser on your input file:
./parser < input.txt -
The parser will validate the input and report any errors found.
-
Place your test input files in the
testsdirectory with a.txtextension. -
Run the test script:
./testingScript.shThis will run the parser on all test files in the
testsdirectory and display the results.
lexer.l: Flex file containing token definitions and lexical analysis rulesparser.y: Bison file containing grammar rules and semantic actionstestingScript.sh: Bash script for running test casesMakefile: Build configuration for the project