The ZEDRAM Language

For pragmatic details, this page is where you should be looking.

The ZEDRAM Language or the Zysys Efficient Data Representation And Modeling Language is a hyper-flexible and sophisticated data representation language that allows for the following:

  • Self-created grammar based on preset options
  • Namespaces (called frameworks)
  • Inline Methods or External Methods which call a function in the script accessing the data.

History & Current Status

zedram_inv.png was originally developed to make use of Perl6's parsing features. Based on a software commission, I needed some implementation of ZEDRAM for Perl5. I was forced to create something based on Scheme using the same design ideals as the original ZEDRAM schematic. ZEDRAM currently translates ZEDRAM code in SCHEME style to valid XML wrapped in <ZEDRAM> </ZEDRAM> tags. ZEDRAM fully implements the Dynamic Parse Tree design goal outlined in the Design goal schematic.

Design Schematics

Currently, ZEDRAM is being implemented in a working proprietary product and being viciously to ensure stability in SCHEME style. SCHEME style existed as the lowest hanging fruit in terms of implementation, as building a Scheme parser is very well documented.

ZEDRAM is under active development (JULY 2018).

grammar.zyg

The main grammar.zyg is analyzed for grammar_delimiter. The grammar file is then re-parsed to get the other details.

Currently, the fields examined and utilized are (with examples):

grammar_delimiter->->
grammar_type->scheme
list_delimiter->,
list_delimiter_replacement_char->_
parser_delimiter->/
parser_delimiter_replacement_char->^

Because of the meta-nature of the list_delimiter and parser_delimiter, both need to be replaced in data with the replacement_char in data that is processed by the parser:

(literal this _ is a test) would yield: this , is a test if the function literal took its arguments and output them.

Implementation

use ZYSYS::ZEDRAM;
use XML::LibXML;
my $zdrm = ZYSYS::ZEDRAM->new(file=>$file, grammar=>"grammar.zyg");
chomp(my $xml = join(' ', @{$zdrm->parse_to_xml()}));
$xml =~ s/\s*$//;
my $dom = XML::LibXML->load_xml(string => $xml);
#... parse $dom to construct the structures you expect.

Currently, ZEDRAM serves as a shorthand of XML ..reducing code to bout 30% of size.

Use Case

Use ZEDRAM when there's a lot of XML data that needs to be represented / entered with a lot of attributes.

Benefits:

  • Using ZEDRAM will help with code consistency as there are fewer places for typos
  • Rapid data entry...a massive 100KB XML file can be entered by hand in about as much time as it takes to enter the raw, unique data.
  • Better code consistency (as unique data is entered)
Weaknesses:
  • Must go through XML to parse data...instead of going right into a data structure
  • Syntax checking in a ZEDRAM file is non-existent
*Editor's note:* ...I'm biased, but I think the benefits are very useful for the situations where there's a lot of data, but a database isn't practical.

Parse Trees

ZEDRAM breaks down input into tokens separated by parentheses then spaces (to remove blank elements from the tokens). It then takes the tokens and reassembles them into parse trees (abstract syntax trees) noting opening and closing parens as the markers for a new branch.

It follows the procedural outline in the Dynamic Parse Trees Schematic.

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng zedram.png r1 manage 13.0 K 2018-07-17 - 02:47 ZachBornheimer ZEDRAM Logo
PNGpng zedram_inv.png r1 manage 13.0 K 2018-07-17 - 02:50 ZachBornheimer (Dark) ZEDRAM Logo
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2018-07-23 - ZachBornheimer
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback