SkillAgentSearch skills...

Gkd

build confidence with LaTeX. appreciations to @iExploder as we together figure out a valid and much better way to call python in LaTex.

Install / Use

/learn @thautwarm/Gkd
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

gkd(搞快点)

alpha version, do not use.

A set of tools to help programming in LaTeX.

pip install wisepy2 gkd, and append contents of gkd.tex to your TeX sources.

1. GKDBNF: The best LaTeX BNF package you've ever seen?

This relies on paperbnf.

Usage

\begin{GKDBNF}{some_unique_id}
!Expressions! <e> ::= <e> ( <e>  )
| let <n> = <e> in <e>
| !$\lambda$! <n> . <e>
| <\mathtt{atom}>

\end{GKDBNF}

capture

Remember to place a blank line in the end of GKDBNF block.

How to write this BNF?

Follow the syntax and lexer rules:

Valid BNF Syntax:

<atom> ::= NONTERMINAL
       | TERMINAL
       | TERMINAL2
       | '|'



<prod> ::= NONTERMINAL '::=' <atom>+ NEWLINE
       | TERMINAL NONTERMINAL '::=' <atom>+ NEWLINE
       | TERMINAL2 NONTERMINAL '::=' <atom>+ NEWLINE
       | '|' <atom>+ <NEWLINE>

Lexer rule by regex:

NEWLINE     = [\r\n]+
NONTERMINAL = <.*?>
TERMINAL2   = !.*?!
TERMINAL    = \S+

Whitespace tokens are ignored.

2. Utilities

\GKDSet{a}{1}

\GKDGet{a} % get you "1"

\GKDPush{xs}{1}
\GKDPush{xs}{2} 
\GKDPop{xs}
\GKDPop{xs} % get you "1"


\newcommand{\addone}[1]{
    \GKDPyCall{"lambda x: eval(x) + 1"}{#1}
}
\addone{2}   % 3
\addone{2.0} % 3.0

Related Skills

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated3y ago
Forks1

Languages

Python

Security Score

70/100

Audited on Feb 1, 2023

No findings