LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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

Recursive Descent, Left Assoc

Posted 08-19-2023 at 04:39 PM by astrogeek
Updated 09-05-2023 at 07:07 PM by astrogeek (Made *input const)

Discussion here and here in the Programming forum prompted me to write a few variations of an incomplete example given in the book:

Compiler Design In C by Allen I. Holub

The example suggests a simple way to obtain a left-associative parse of a list from a recursive descent parser which implements a simple right-recursive grammar.

The example is found on pages 176-177 of the book, and is incomplete, intended to illustrate the idea, not intended as working...
Moderator
Views 416 Comments 0 astrogeek is offline
Old

Flex Based Outline Generator

Posted 11-15-2021 at 02:36 AM by astrogeek
Updated 11-15-2021 at 02:43 AM by astrogeek

This little project was suggested by my participation in the thread Bison YACC compiler generator question in the Programming forum which was started by LQ member schmitta. It is a simple program which produces formatted outlines, or other indented text output, from plain text source files with a few simple markup options.

The original question in the linked thread related to a Flex/Bison generated parser, but as the thread progressed it seemed to me that some basic level of function...
Moderator
Views 1430 Comments 0 astrogeek is offline
Old

Test Cases: Sign

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

This post is part of the Alphanumeric Calculator program group.

Test cases to validate handling of sign.

The test case input file:

Code:
cat tests_sign
#both
############ Numbers with signs
+0
+1
-0
-1
-1*-1
-1*+1
+1*-1
+1*+1
############ Numeric expressions with signs
positive zero
positive one
negative zero
negative one
negative one times
...
Moderator
Views 743 Comments 0 astrogeek is offline
Old

Test Cases: Limits

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

This post is part of the Alphanumeric Calculator program group.

Test cases to validate limits and range of expressions, undefined input errors.

Test cases input file:

Code:
cat tests_limits
/* Tests detection and reporting of limits and unexpected input
*/
######## Valid - Min/Max values
999999999999
-999999999999
nine hundred ninety nine billion nine hundred ninety nine million nine hundred ninety nine thousand nine
...
Moderator
Views 444 Comments 0 astrogeek is offline
Old

Test Cases: Associativity and Precedence of Math Expressions

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

This post is part of the Alphanumeric Calculator program group.

Test cases to validate associativity and precedence handling in math expressions.

Test cases input file:

Code:
cat tests_precedence
/* Test of associativity and precedence in math expressions
   Input here is symbolic for clarity, alpha input will test same, not shown
   Remember: This is integer math as performed by basic C oeprators on long long values
*/
numeric
...
Moderator
Views 336 Comments 0 astrogeek is offline

  



All times are GMT -5. The time now is 06:37 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