https://github.com/aggstam/flex-c-declarations
Simple Flex program producing the corresponding C code to display all the declarions of another C code file.
https://github.com/aggstam/flex-c-declarations
c flex language-processing
Last synced: 7 months ago
JSON representation
Simple Flex program producing the corresponding C code to display all the declarions of another C code file.
- Host: GitHub
- URL: https://github.com/aggstam/flex-c-declarations
- Owner: aggstam
- License: gpl-3.0
- Created: 2023-01-24T11:05:57.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-16T13:34:57.000Z (over 2 years ago)
- Last Synced: 2025-01-12T20:33:34.404Z (9 months ago)
- Topics: c, flex, language-processing
- Language: C
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flex-C-declarations
Simple Flex program producing the corresponding C code to display all the declarions of another C code file.
These include:
- System libraries
- User libraries
- Forward declarations
- Function definitionsCompilation and tests execution is streamline via a Makefile.
Two test C code files have been provided to play with.## Usage
```
% make
```
Makefile can be configured to use a different test case set and/or files.## Execution example
```
❯ make
flex -o flex_c_declarations.c flex_c_declarations.l
gcc flex_c_declarations.c -o flex_c_declarations -lfl
./flex_c_declarations test_file_0.c
System Library: #include
User Library: #include "genlib.h"
User Library: #include "simpio.h"
Macro definition: #define N 10
Forward Function Declaration: bool IsLeapYear(int year);
Forward Function Declaration: int MonthDays(int month, int year);
Forward Function Declaration: bool valide_date(int dd, int mm, int yy);
Forward Function Declaration: long Read_and_Calculate(int curyear);
Function Definition: bool IsLeapYear(int year)
Function Definition: int MonthDays(int month, int year)
Function Definition: bool valide_date(int dd, int mm, int yy)
Function Definition: long Read_and_Calculate(int curyear)
3 Libraries are included in file.
There are 4 fw function declarations and 4 fun defs.
./flex_c_declarations test_file_1.c
System Library: #include
System Library: #include
System Library: #include
Forward Function Declaration: void read_data(char user_string[], int *L, int *X, int *Y);
Forward Function Declaration: void leftjust(char str[], int L, int X, int Y);
Forward Function Declaration: void rightjust(char str[], int L, int X, int Y);
Forward Function Declaration: void centerjust(char str[], int L, int X, int Y);
Function Definition: void read_data(char str[], int *L, int *X, int *Y)
Function Definition: void leftjust(char str[], int L, int X, int Y)
Function Definition: void rightjust(char str[], int L, int X, int Y)
Function Definition: void centerjust(char str[], int L, int X, int Y)
3 Libraries are included in file.
There are 4 fw function declarations and 4 fun defs.
```