Menu

Text input analysis

Jan

The text input analysis is carried out by a parser generated by byacc/j from a grammar description that describes all possible language elements and how the can be combined. These language elements are detected by a scanner generated by jflex.

The language elements are symbols that are internally represented by one class for each element. All these classes share the same base class ParserVal, which has a list of references to other ParserVal instances, thereby building an object tree with several branches per node (the parse tree), each node representing one element. How many branches a node can actually have depends on the type of node; for most node types each branch position represents a certain semantic option.

To see how this parse tree is actually built, look at the files tools/soundcomp,y for the parser and tools/soundcomp.flex for the scanner.

This relatively simple process is extended by the possibility to have macro preprocessing and file inclusion, similar to the preprocessor in C, which is carried out in a separate scanning/parsing step prior to the actual SoundComp language analysis.

Only when the whole text input has been preprocessed, scanned and parsed, and the result is a valid parse tree, SoundComp will (at the point that this will be implemented) instanciate a control logic that will trigger sound generators and sound processing elements that will actually result in a sound file.


Related

Wiki: What is SoundComp

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.