This is part of a plugin I'm writing for TeXmacs that translates the Hybrid Logic input and output of the HyLoRes and HyLoTab proof systems from ASCII into TeX.
#!/usr/bin/perl -w # negation: ! ~ - # conjunction: ^ & && # disjunction: v | || # top: true top # bottom: false bottom # implication: -> <- # equivalence: <-> # prop.letters: p P P[0-9]+ (all words excluding the letter v) # nominals: n N N[0-9]+ (all words excl...) # relations: r R R[0-9]+ (...) # diamonds: <> <label> (e.g. "<R2>" a relation 2 diamond) # boxes: [] [label] # down arrow: down # at operator: @i expr. (where i is a nominal) # nominal : expr. (e.g. "Here : P^<>Q") while(<>) { chomp; s/\{([^\}]*)\}/$1/; # {...} blocks s/\<\>/\\wasyDiamond /g; # diamonds s/\<(\w+)\>/\\wasyDiamond_{$1}/g; # named diamonds s/\[\]/\\box /g; # boxes s/\[(\w+)\]/\\box_{$1}/g; # named boxes s/\<-\>/\\leftrightarrow /g; # equivalence s/-\>/\\rightarrow /g; # implication (right) s/\<-/\\leftarrow /g; # implication (left) s/down/\\downarrow /ig; # down (case insensitive) s/\@(\w+)/\@_{$1}/g; # at @ s/(\w+)\s*:/\@_{$1}/g; s/\@\(\s*(\S+)\s*,([^\]]*)\)/\@_{$1} $2/g; s/\@\((\w+),/\@_{$1} \(/g; s/(v|\|{1,2})/\\vee /g; # disjunction s/(-|!|~)/\\neg /g; # negation s/(true|top)/\\top /ig; # top s/(false|bottom)/\\perp /ig; # bottom s/(\^|\&{1,2})/\\wedge /g; # conjunction s/\[([^\]]*)\]/$1/g; # [...] blocks s/p([0-9]+)/P_{$1} /ig; # prop letters s/n([0-9]+)/N_{$1} /ig; # nominal letters s/r([0-9]+)/R_{$1} /ig; # relation letters print "\\par\\noindent\$$_\$"; } print "\\bye";

In reply to Hybrid Logic ASCII - TeX by wrvhage

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.