Giter VIP home page Giter VIP logo

scanner-sgml's Introduction

Simple SGML Scanner

A rudimentary scanner built in C with Flex to parse tokens from Standard Generalized Markup Language documents. The scanner keeps track of "relevant" tags consisting of "TEXT", "DATE", "DOC", "DOCNO", "HEADLINE", "LENGTH", and "P", and only prints out tokens found between these relevant tags. If a tag is incorrectly closed, an error will be displayed. After the scanner is complete, a list of unclosed tags will also be listed.

Improvements

While developing the scanner, I overlooked tracking tags that are considered "relevant" and "irrelevant", as the first "working" version of the scanner printed out all proper tags. This oversight resulted in using an int variable to track when an open irrelevant tag was used, and increment accordingly as tags were nested deeper inside the irrelevant tag. If I were to redo this assignment, I would refactor this entire portion and instead modify my stack strucures to hold information about which tags were considered irrelevant (or considered relevant but inside a set of irrelvant tags).

Build/Compile

To build and compile the scanner, run:

make

Test files

Test files were developed over the course of the development process. Three files were leftover that aimed to cover ideal and error cases. To execute a series of all three tests, run:

make test

Run scanner on newsdata.txt

To test the provided test file, separate commands were included. To test newsdata.txt and print out, run:

make run

To test newsdata.txt and print out to sample.out, run:

make run_out

Run scanner on external files

To run the scanner on your own files, send a document with SGML formatting to the stdin on the program with:

./scanner < your_file.txt

Cleanup

To simply cleanup the compiled files and scanned output, run:

make clean

Credit

To save time developing my own stack data structure, code was used from: http://stackoverflow.com/questions/1919975/creating-a-stack-of-strings-in-c

scanner-sgml's People

Stargazers

Juergen Kosel avatar

Watchers

James Cloos avatar Matt Breckon avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.