in reply to Re^4: Is an aXML compiler possible?
in thread Is an aXML compiler possible?

I am having difficulty explaining it in a manner that you understand
Did you try to write it down in Backus-Naur-form? At least that would settle the format of the language and then you are already half way done in writing a compiler, well the parser part of it at least.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^6: Is an aXML compiler possible?
by Logicus (Initiate) on Oct 28, 2011 at 13:04 UTC

    I think it would go something like this

    <symbol> ::= <open> <name> <args> <close> <data> <open> <name> <clos +e> <open> ::= <primary> | <secondary> | <teriary> <close> ::= <primary> | <secondary> | <teriary> <name> ::= <string> <args> ::= <key> <equals> <quote> <value> <quote> ... <data> ::= <xml> <primary> ::= <(> | <)> <secondary> ::= <<> | <>> <teriary> ::= <[> | <]>

    Something like that, sorry if that's completely wrong I've never used BNF before.

      • aXML allows nested "symbols", but your grammar does not. ("Directives" might be a better name.)
      • You're grammar allows <foo], but aXML does not.
      • &lab; is conspicuously absent.
      • None of the rules you gave make sense as the starting rule.
      • Finally, the word "xml' should not appear in there at all. There's absolutely no requirement for aXML to be used for XML, you said.

        Well that's because I've never used BNF before and I don't really know what I'm doing with it.

        As for the special chars, they are not used in aXML, only in the Perl plugins. They exist solely so Perl can correctly work with aXML. aXML itself does not need them or care about them at all, hence they don't belong in a formal specification of aXML.

      The little I know of BNF, I think your representation is not correct, but I leave it to more experienced Monks to look into it.

      CountZero

      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James