LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs > astrogeek
User Name
Password

Notices


Tutorials and Templates A collection of tutorials and templates of my own making.
Old

Test Cases: Optional AND Input and Output Handling

Posted 10-10-2021 at 11:52 PM by astrogeek
Updated 10-11-2021 at 12:10 AM by astrogeek

This post is part of the Alphanumeric Calculator program group.

Test cases to validate handling of optional "and" in english numeric expressions.

Use of "and" in input stream is always optional. For example, either of these basic forms is allowed:

Code:
one thousand one hundred one
one thousand one hundred and one
By default output follows input usage per expression - if "and" appears in the...
Moderator
Views 244 Comments 0 astrogeek is offline
Old

Test Cases: Multi-line Input

Posted 10-10-2021 at 11:52 PM by astrogeek

This post is part of the Alphanumeric Calculator program group.

Test cases to validate multi-line input expressions.

By design a single expression is terminated by a line break. But you may enter expressions which span multiple lines by escaping the line break with a backslash as the last character before the line break similar to the usage in C preprocessor macro definitions, among others.

Test cases input file:

Code:
cat tests_multiline
...
Moderator
Views 342 Comments 0 astrogeek is offline
Old

Alphanumeric Calculator: GNU Bison Specification

Posted 10-01-2021 at 07:34 PM by astrogeek
Updated 10-07-2021 at 01:34 PM by astrogeek (Rev. 3 source / typo)

This post is Part 4 of the Alphanumeric Calculator program group.

Note: This is Rev. 3 Bison version and requires Rev. 3 Flex version.

Copy the code below into a file named alphacalc.y in your local build directory for this project, the same directory where Makefile and alphacalc.l are located.

I wrote this version using GNU Bison 3.7.6 and gcc 10.3 on a Slackware -current platform, but it should work using any not-too-old Bison with one small change...
Moderator
Views 711 Comments 0 astrogeek is offline
Old

Alphanumeric Calculator: Flex Specification

Posted 10-01-2021 at 07:29 PM by astrogeek
Updated 10-07-2021 at 01:47 AM by astrogeek (Rev. 3 source)

This post is Part 3 of the Alphanumeric Calculator program group.

Note: This is Rev. 3 version and works with Rev. 3 Bison specification.

Copy the code below into a file named alphacalc.l in your build directory for this project where Makefile and alphacalc.y are located.

This is the specification file for a Flex generated lexical analyzer, also called a lexer or scanner.

A brief description of the file contents follows, but if you are...
Moderator
Views 487 Comments 0 astrogeek is offline
Old

Alphanumeric Calculator: Makefile

Posted 10-01-2021 at 07:29 PM by astrogeek
Updated 10-03-2021 at 12:45 PM by astrogeek (meh... tpoys)

This post is Part 2 of the Alphanumeric Calculator program group.

Copy the code below into a file named Makefile in your local build directory for this project, the same directory where alphacalc.l and alphacalc.y are located.

Read and follow comment about TABs at top of the file.

I have it configured to build with gcc and -std=c17, although this project does not use any features specific to the c17 standard. If you use a different compiler or an older gcc...
Moderator
Views 443 Comments 0 astrogeek is offline

  



All times are GMT -5. The time now is 10:49 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration