The burgled-batteries.syntax Reference Manual

This is the burgled-batteries.syntax Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Jan 15 04:28:31 2023 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 burgled-batteries.syntax

Embedded Python syntax for burgled-batteries

Author

Mariano Montone

Home Page

https://github.com/mmontone/burgled-batteries.syntax

License

MIT

Long Description

# burgled-batteries.syntax

[![Quicklisp](http://quickdocs.org/badge/burgled-batteries.syntax.svg)](http://quickdocs.org/burgled-batteries.syntax/)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)

This library provides Embedded Python syntax for burgled-batteries

To enable the syntax:

“‘lisp
(python.syntax:enable-python-syntax)
“‘

Python syntax is enclosed between brackets. The embedded syntax is very similar to Python’s syntax, with some differences:

* Identifiers staring with the ‘$‘ character are parsed as Lisp variable references.
* To convert the Python expression result to a Lisp object, use the ‘^‘ operator.
* Lisp expressions can be embedded in Python code, with this syntax: ‘$(<lisp expression>)‘

Example:
“‘lisp
(let (($url "http://pinterface.livejournal.com/data/atom"))
[^feedparser.parse($url)])
“‘

Some examples:

“‘lisp
(import :feedparser)
[^feedparser.parse(’http://pinterface.livejournal.com/data/atom’)]
; => #<HASH-TABLE>
“‘

To explore what is happening behind the scenes, quote the Python expression:

“‘lisp
PYTHON> ’[^.feedparser.parse(’http://pinterface.livejournal.com/data/atom’)]
(LET ((#:TRANSFORMED2520
(CFFI:CONVERT-FROM-FOREIGN
(CALL* (REF* "feedparser") "parse"
(STRING.FROM-STRING*
"http://pinterface.livejournal.com/data/atom"))
’PYTHON.CFFI::OBJECT!)))
#:TRANSFORMED2520)
“‘

Bigger example:
“‘lisp
PYTHON> (let (($cal [icalendar.Calendar()]))
[$cal.add(’prodid’, ’-//My calendar product//mxm.dk//’)]
(let (($event [icalendar.Event()]))
[$event.add(’summary’, ’Python meeting about calendaring’)]
[$event.add(’dtstart’, datetime.datetime(2005,4,4,8,0,0))]
[$event.add(’dtend’, datetime.datetime(2005,4,4,10,0,0))]
[$event.add(’dtstamp’, datetime.datetime(2005,4,4,0,10,0))]
(let (($organizer [icalendar.vCalAddress(’MAILTO: noone@example.com’)]))
[$organizer.params[’cn’] = icalendar.vText(’Max Rasmussen’)]
[$organizer.params[’role’] = icalendar.vText(’CHAIR’)]
[$event[’organizer’] = $organizer]
[$event[’location’] = icalendar.vText(’Odense, Denmark’)]

[$event[’uid’] = ’20050115T101010/27346262376@mxm.dk’]
[$event.add(’priority’, 5)]

(let (($attendee [icalendar.vCalAddress(’MAILTO:maxm@example.com’)]))
[$attendee.params[’cn’] = icalendar.vText(’Max Rasmussen’)]
[$attendee.params[’ROLE’] = icalendar.vText(’REQ-PARTICIPANT’)]
[$event.add(’attendee’, $attendee, encode=0)])

(let (($attendee [icalendar.vCalAddress(’MAILTO:the-dude@example.com’)]))
[$attendee.params[’cn’] = icalendar.vText(’The Dude’)]
[$attendee.params[’ROLE’] = icalendar.vText(’REQ-PARTICIPANT’)]
[$event.add(’attendee’, $attendee, encode=0)])

[$cal.add_component($event)]
[^$cal.to_ical()])))
=>

"BEGIN:VCALENDAR
PRODID:-//My calendar product//mxm.dk//
BEGIN:VEVENT
SUMMARY:Python meeting about calendaring
DTSTART;VALUE=DATE-TIME:20050404T080000
DTEND;VALUE=DATE-TIME:20050404T100000
DTSTAMP;VALUE=DATE-TIME:20050404T001000Z
UID:20050115T101010/27346262376@mxm.dk
LOCATION:Odense\\, Denmark
MAILTO:MAXM@EXAMPLE.COM:attendee
MAILTO:THE-DUDE@EXAMPLE.COM:attendee
ORGANIZER;CN=\"Max Rasmussen\";ROLE=CHAIR:MAILTO: noone@example.com
PRIORITY:5
END:VEVENT
END:VCALENDAR"
“‘

For more examples, checkout the syntax tests or [this blog post](http://mmontone-programming.blogspot.com.ar/2014/09/embedding-python-in-common-lisp.html).

Dependencies
  • burgled-batteries (system).
  • esrap (system).
  • named-readtables (system).
Source

burgled-batteries.syntax.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 burgled-batteries.syntax/burgled-batteries.syntax.asd

Source

burgled-batteries.syntax.asd.

Parent Component

burgled-batteries.syntax (system).

ASDF Systems

burgled-batteries.syntax.


3.1.2 burgled-batteries.syntax/package.lisp

Source

burgled-batteries.syntax.asd.

Parent Component

burgled-batteries.syntax (system).

Packages

burgled-batteries.syntax.


3.1.3 burgled-batteries.syntax/syntax.lisp

Dependency

package.lisp (file).

Source

burgled-batteries.syntax.asd.

Parent Component

burgled-batteries.syntax (system).

Public Interface

enable-python-syntax (function).

Internals

4 Packages

Packages are listed by definition order.


4.1 burgled-batteries.syntax

Source

package.lisp.

Nickname

python.syntax

Use List
  • common-lisp.
  • esrap.
Public Interface

enable-python-syntax (function).

Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: enable-python-syntax ()
Package

burgled-batteries.syntax.

Source

syntax.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *lisp-reference-prefix*
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Special Variable: *transform-character*
Package

burgled-batteries.syntax.

Source

syntax.lisp.


5.2.2 Macros

Macro: push-last (thing list)
Package

burgled-batteries.syntax.

Source

syntax.lisp.


5.2.3 Ordinary functions

Function: call (object method &rest args)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: call* (object method &rest args)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: call-with-split-args (args body)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: compile-expression (expression)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: compile-python (string)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: is-false (x)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: is-none (x)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: is-true (x)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: not-doublequote (char)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: parse-python (string)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: py-slot-value (object slot)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: ref (name)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: ref* (name)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: run-python (input)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: send (method object &rest args)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: send* (method object &rest args)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Function: split-args (args)
Package

burgled-batteries.syntax.

Source

syntax.lisp.


5.2.4 Generic functions

Generic Function: compile-expression% (expression-type expression)
Package

burgled-batteries.syntax.

Source

syntax.lisp.

Methods
Method: compile-expression% ((type (eql :lisp-expression)) expression)
Method: compile-expression% ((type (eql :transform)) expression)
Method: compile-expression% ((type (eql :assignment)) expression)
Method: compile-expression% ((type (eql :index-access)) expression)
Method: compile-expression% ((type (eql :property-access)) expression)
Method: compile-expression% ((type (eql :method-call)) expression)
Method: compile-expression% ((type (eql :function-call)) expression)
Method: compile-expression% ((type (eql :lisp-reference)) expression)
Method: compile-expression% ((type (eql :python-reference)) expression)
Method: compile-expression% ((type (eql :literal-dictionary)) expression)
Method: compile-expression% ((type (eql :literal-list)) expression)
Method: compile-expression% ((type (eql :literal-float)) expression)
Method: compile-expression% ((type (eql :literal-long)) expression)
Method: compile-expression% ((type (eql :literal-integer)) expression)
Method: compile-expression% ((type (eql :literal-string)) expression)
Method: compile-expression% ((type (eql :literal-none)) expression)
Method: compile-expression% ((type (eql :literal-boolean)) expression)

Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   C   E   F   G   I   M   N   P   R   S  
Index Entry  Section

C
call: Private ordinary functions
call*: Private ordinary functions
call-with-split-args: Private ordinary functions
compile-expression: Private ordinary functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-expression%: Private generic functions
compile-python: Private ordinary functions

E
enable-python-syntax: Public ordinary functions

F
Function, call: Private ordinary functions
Function, call*: Private ordinary functions
Function, call-with-split-args: Private ordinary functions
Function, compile-expression: Private ordinary functions
Function, compile-python: Private ordinary functions
Function, enable-python-syntax: Public ordinary functions
Function, is-false: Private ordinary functions
Function, is-none: Private ordinary functions
Function, is-true: Private ordinary functions
Function, not-doublequote: Private ordinary functions
Function, parse-python: Private ordinary functions
Function, py-slot-value: Private ordinary functions
Function, ref: Private ordinary functions
Function, ref*: Private ordinary functions
Function, run-python: Private ordinary functions
Function, send: Private ordinary functions
Function, send*: Private ordinary functions
Function, split-args: Private ordinary functions

G
Generic Function, compile-expression%: Private generic functions

I
is-false: Private ordinary functions
is-none: Private ordinary functions
is-true: Private ordinary functions

M
Macro, push-last: Private macros
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions
Method, compile-expression%: Private generic functions

N
not-doublequote: Private ordinary functions

P
parse-python: Private ordinary functions
push-last: Private macros
py-slot-value: Private ordinary functions

R
ref: Private ordinary functions
ref*: Private ordinary functions
run-python: Private ordinary functions

S
send: Private ordinary functions
send*: Private ordinary functions
split-args: Private ordinary functions