Tag 'parsing':

Check Braces
Aug 3rd, 2015

algorithms brackets parsing
Annual hours saved: 1

The other day I needed a quick way to check a file for matching braces (and brackets and parentheses). I couldn’t find an easy way to do this on the command-line, so I wrote this simple Java class, and wrapped it into a .jar:


It correctly identifies mismatched, unexpected, and improperly nested brackets (e.g. { ( } )). It is however, completely language agnostic, and will not notice if brackets are in a comment block or string, or are otherwise escaped. It just does a naive count.

ADHOC Node Types
Aug 15th, 2014

AST parsing types

An ADHOC project consists of a tree of nodes, each of which represents a logical concept in programming. There are 6 main types of nodes in ADHOC:

  • Action Nodes represent actions in the AOP model. They are generally composed of children that represent simpler actions. Actions belong to packages, and the root node for any project is always an action definition for the highest-level function of the project (e.g. “Run Web Server”). Once an action is defined, it can be used in other parts of the project. Some important system actions are already defined, and can be called from any project. Action definitions appear as green rectangles and action calls appear as blue rectangles.
  • Group Nodes are a way of establishing relationships between other particular other nodes. The “serial group” indicates that any actions within it always be performed in sequence, while otherwise, sibling actions can may be performed concurrently at the discretion of the code generation process. Serial groups appear as dashed gray rectangles around their children. [Read More]

yylex_destroy() is well hidden!
Jun 29th, 2014

documentation frustrating memory leak parsing YACC

If you notice, in ADHOC’s makefile, there is a recipe called ‘grind’ that I use as a quick spot-check for memory leaks and other issues during builds. For the longest time, ‘grind’ kept showing a couple un-freed memory blocks after yyparse had finished parsing my input files, and I couldn’t figure out where the blocks were being allocated. Valgrind kept pointing to YACC/Bison‘s lex.yy.c code file, so I figured it must be a YACC issue, and I went Googling. [Read More]

Your E-Sheep:

( change )

Recent Posts:

10/14 - ADHOC Changelog
8/19 - And now… random puppies!
8/3 - Check Braces
7/23 - Make Limits Java Heap Size on 32-bit Linux
7/21 - Terminal Color Support in Makefiles

Top Tags:

aaaaargh! algorithms automatic awesome colors config development environment documentation frustrating java linux make parsing project management random syntax-highlighting terminal types

Random Quote:

The problem with quotes on the internet is that you can't always be sure of their authenticity.
Abraham Lincoln

Powered By:

2017 - Creative Commons 3.0