cobol-interpreter-lab/lab-3
Preston Carman 47d1e653ed Lab 3 2024-10-17 11:07:48 -07:00
..
samples Lab 3 2024-10-17 11:07:48 -07:00
README.md Lab 3 2024-10-17 11:07:48 -07:00
main.c Lab 3 2024-10-17 11:07:48 -07:00
main_test.c Lab 3 2024-10-17 11:07:48 -07:00
scanner.flex Lab 3 2024-10-17 11:07:48 -07:00
token.h Lab 3 2024-10-17 11:07:48 -07:00
utest.h Lab 3 2024-10-17 11:07:48 -07:00

README.md

Flex Scanner

Create a scanner for your sample programs. See the example lab for Python.

Language Scanner

Add the tokens needed to scan your sample code files.

In addition include the following:

  • All the math operations (+,-,/,* etc.)
  • All boolean expression (==,>,< etc.)
  • All relational operators (not,and,or)
  • ...

Testing the Language Scanner

Write unit test for your sample code. The sample program uses utest.h which is a simple c unit test framework. The documentation can be found at https://github.com/sheredom/utest.h.

The main.c has been replaced with unit test code. Your task is to create one unit test for each sample file.

When you submit the code to GitLab, the CI should automatically compile and run your test code. To recieve full credit, the tests must pass when run through GitLab CI.

Build Process

To build the scanner.c run the following flex command.

flex -o scanner.c scanner.flex

Then build the main.c and scanner.c using gcc.

gcc main_test.c scanner.c -o scanner_test.out

Then execute the test suite using ./scanner_test.out.

./scanner_test.out

Scanner Only

flex -o scanner.c scanner.flex
gcc main.c scanner.c -o scanner.out
./scanner.out

Grading Rubric

The grading will be over the following categories.

Points Description


30 points Tests for individual language tokens 10 points Ability to scan — Hello world 20 points Ability to scan — Quadratic equation 20 points Ability to scan — Integer sorting 20 points Passes continuous integration

Turn In

Please submit the URL of your gitlab project to D2L's Brightspace with your report. On gitlab update the lab-3 folder to have your report and code snippets before the due date.