The fucc-parser Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The fucc-parser Reference Manual

This is the fucc-parser Reference Manual, version 0.2.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 04:46:56 2022 GMT+0.

Table of Contents


1 Introduction

-*- mode: outline; -*-
* What's FUCC

FUCC is FU Compiler Compiler.  FUCC converts LALR(1) or LR(1)
context-free grammar into Common Lisp program that parses input with
actions.

FUCC consists of two parts: generator and parser.  Generator is used
for generating parsing tables.  Parser uses the tables for parsing an
input.  If your grammar is fixed, you need generator for compilation only
and don't need to distribute it.

See files in doc directory, especially doc/FUCC-FAQ.


2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 fucc-parser

LL and LR/LALR parser runtime system

Author

Ivan Boldyrev

License

MIT

Version

0.2.2

Source

fucc-parser.asd.

Child Component

parser (module).


3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 fucc-parser/parser

Source

fucc-parser.asd.

Parent Component

fucc-parser (system).

Child Components

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


4.1.1 fucc-parser/fucc-parser.asd

Source

fucc-parser.asd.

Parent Component

fucc-parser (system).

ASDF Systems

fucc-parser.


4.1.2 fucc-parser/parser/fucc-package.lisp

Source

fucc-parser.asd.

Parent Component

parser (module).

Packages

fucc.


4.1.3 fucc-parser/parser/fucc-decl.lisp

Dependency

fucc-package.lisp (file).

Source

fucc-parser.asd.

Parent Component

parser (module).

Public Interface
Internals

4.1.4 fucc-parser/parser/fucc-util.lisp

Dependencies
Source

fucc-parser.asd.

Parent Component

parser (module).

Internals

4.1.5 fucc-parser/parser/fucc-parser.lisp

Dependencies
Source

fucc-parser.asd.

Parent Component

parser (module).

Public Interface

parser-lr (function).

Internals

4.1.6 fucc-parser/parser/fucc-ll.lisp

Dependency

fucc-package.lisp (file).

Source

fucc-parser.asd.

Parent Component

parser (module).

Public Interface

parser-ll (function).

Internals

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 fucc

Source

fucc-package.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


6.1.1 Special variables

Special Variable: *next-data*
Package

fucc.

Source

fucc-decl.lisp.

Special Variable: *next-token*

Data associated with next token returned by lexer; accessible in reduction actions.

Package

fucc.

Source

fucc-decl.lisp.


6.1.2 Ordinary functions

Function: parser-ll (lexer ll-data)
Package

fucc.

Source

fucc-ll.lisp.

Function: parser-lr (lexer parser)
Package

fucc.

Source

fucc-parser.lisp.


6.1.3 Standalone methods

Method: print-object ((obj state) stream)
Source

fucc-decl.lisp.


6.1.4 Conditions

Condition: lr-parse-error-condition

LR-specific parser error

Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

parse-error-condition.

Direct methods

error-config.

Direct slots
Slot: config

Runtime configuration of parser

Initargs

:config

Readers

error-config.

Writers

This slot is read-only.

Condition: parse-error-condition

General parsing error

Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

condition.

Direct subclasses
Direct methods
Direct slots
Slot: token-id

ID of token that caused the error

Initargs

:token-id

Readers

error-token-id.

Writers

This slot is read-only.

Slot: data

Semantic data associated with token

Initargs

:data

Readers

error-data.

Writers

This slot is read-only.


6.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.1 Macros

Macro: ll-final-action (len action)

Final ACTION (form that returns function) where rule length is LEN (unsigned byte)

Package

fucc.

Source

fucc-ll.lisp.

Macro: ll-middle-action (len action)

Non-final ACTION (form that return function). LEN is unsigned byte that defines number of preceeding tokens.

Package

fucc.

Source

fucc-ll.lisp.

Macro: rev-apply (n func list-exp)
Package

fucc.

Source

fucc-ll.lisp.

Macro: stack-popper (n)
Package

fucc.

Source

fucc-ll.lisp.

Macro: with-lr-config ((state-stack-var term-stack-var data-stack-var) stack &body body)

Components of stack returned by STACK expressions are bound to variables named by symbols in STATE-STACK-VAR, TERM-STACK-VAR and DATA-STACK-VAR. These variables can be used in the BODY.

Package

fucc.

Source

fucc-decl.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.2 Ordinary functions

Function: accept-action-p (object)
Package

fucc.

Source

fucc-decl.lisp.

Function: action-type (action)

Action designator (implementation-dependent)

Package

fucc.

Source

fucc-decl.lisp.

Function: alist-to-hash-table (list)
Package

fucc.

Source

fucc-util.lisp.

Function: bin-search-goto-table (table key)

Binary search in array of cons pairs: (key . value).
Because of nature of goto-table search is always successfull, so error check are not performed.
Returns value associated with the KEY.

Package

fucc.

Source

fucc-util.lisp.

Function: copy-accept-action (instance)
Package

fucc.

Source

fucc-decl.lisp.

Function: copy-error-action (instance)
Package

fucc.

Source

fucc-decl.lisp.

Function: copy-lr-config (instance)
Package

fucc.

Source

fucc-decl.lisp.

Function: copy-reduce-action (instance)
Package

fucc.

Source

fucc-decl.lisp.

Function: copy-shift-action (instance)
Package

fucc.

Source

fucc-decl.lisp.

Function: copy-state (instance)
Package

fucc.

Source

fucc-decl.lisp.

Function: error-action-p (object)
Package

fucc.

Source

fucc-decl.lisp.

Function: ll-rule-actions (ll-rule)
Package

fucc.

Source

fucc-ll.lisp.

Function: ll-rule-nterms (ll-rule)
Package

fucc.

Source

fucc-ll.lisp.

Function: ll-terminal-p (id)
Package

fucc.

Source

fucc-ll.lisp.

Function: longer-p (list len)

True, iff LIST is longher than LEN.

Package

fucc.

Source

fucc-parser.lisp.

Reader: lr-config-data-stack (instance)
Writer: (setf lr-config-data-stack) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

data-stack.

Function: lr-config-p (object)
Package

fucc.

Source

fucc-decl.lisp.

Reader: lr-config-state-stack (instance)
Writer: (setf lr-config-state-stack) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

state-stack.

Reader: lr-config-term-stack (instance)
Writer: (setf lr-config-term-stack) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

term-stack.

Function: make-accept-action (&key)
Package

fucc.

Source

fucc-decl.lisp.

Function: make-error-action (&key)
Package

fucc.

Source

fucc-decl.lisp.

Function: make-lr-config (&key state-stack term-stack data-stack)
Package

fucc.

Source

fucc-decl.lisp.

Function: make-reduce-action (&key term len function)
Package

fucc.

Source

fucc-decl.lisp.

Function: make-shift-action (&key new-state)
Package

fucc.

Source

fucc-decl.lisp.

Function: make-state (&key id table)
Package

fucc.

Source

fucc-decl.lisp.

Function: negative->nt (ng)
Package

fucc.

Source

fucc-ll.lisp.

Function: nsplit-list (list n)

Return two values: NREVERSEd prefix of LIST of length N and suffix. LIST is destructively modified.

Package

fucc.

Source

fucc-parser.lisp.

Function: nt->negative (id)
Package

fucc.

Source

fucc-ll.lisp.

Function: parser-lr--reduce! (config action parser *next-token* *next-data*)
Package

fucc.

Source

fucc-parser.lisp.

Function: parser-lr--shift! (config atom-id data state)
Package

fucc.

Source

fucc-parser.lisp.

Function: pop-n-stack (data-stack action-stack n)
Package

fucc.

Source

fucc-ll.lisp.

Reader: reduce-action-function (instance)
Writer: (setf reduce-action-function) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

function.

Reader: reduce-action-len (instance)
Writer: (setf reduce-action-len) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

len.

Function: reduce-action-p (object)
Package

fucc.

Source

fucc-decl.lisp.

Reader: reduce-action-term (instance)
Writer: (setf reduce-action-term) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

term.

Reader: shift-action-new-state (instance)
Writer: (setf shift-action-new-state) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

new-state.

Function: shift-action-p (object)
Package

fucc.

Source

fucc-decl.lisp.

Reader: state-id (instance)
Writer: (setf state-id) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

id.

Function: state-p (object)
Package

fucc.

Source

fucc-decl.lisp.

Reader: state-table (instance)
Writer: (setf state-table) (instance)
Package

fucc.

Source

fucc-decl.lisp.

Target Slot

table.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.3 Generic functions

Generic Reader: error-config (condition)
Package

fucc.

Methods
Reader Method: error-config ((condition lr-parse-error-condition))
Source

fucc-decl.lisp.

Target Slot

config.

Generic Reader: error-data (condition)
Package

fucc.

Methods
Reader Method: error-data ((condition parse-error-condition))
Source

fucc-decl.lisp.

Target Slot

data.

Generic Reader: error-token-id (condition)
Package

fucc.

Methods
Reader Method: error-token-id ((condition parse-error-condition))
Source

fucc-decl.lisp.

Target Slot

token-id.

Generic Reader: possible-actions (condition)
Package

fucc.

Methods
Reader Method: possible-actions ((condition parse-conflict-condition))
Source

fucc-decl.lisp.

Target Slot

possible-actions.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.4 Conditions

Condition: parse-conflict-condition

Unresolved conflict in parser

Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

parse-error-condition.

Direct methods

possible-actions.

Direct slots
Slot: possible-actions

List of conflicting actions

Initform

(quote nil)

Initargs

:actions

Readers

possible-actions.

Writers

This slot is read-only.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.5 Structures

Structure: accept-action
Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

structure-object.

Structure: error-action
Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

structure-object.

Structure: lr-config
Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: state-stack
Type

list

Initform

(error ")")

Readers

lr-config-state-stack.

Writers

(setf lr-config-state-stack).

Slot: term-stack
Type

list

Readers

lr-config-term-stack.

Writers

(setf lr-config-term-stack).

Slot: data-stack
Type

list

Readers

lr-config-data-stack.

Writers

(setf lr-config-data-stack).

Structure: reduce-action
Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: term
Type

fucc::term

Initform

0

Readers

reduce-action-term.

Writers

(setf reduce-action-term).

Slot: len
Type

unsigned-byte

Initform

0

Readers

reduce-action-len.

Writers

(setf reduce-action-len).

Slot: function
Package

common-lisp.

Type

(or fixnum function)

Initform

(function list)

Readers

reduce-action-function.

Writers

(setf reduce-action-function).

Structure: shift-action
Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: new-state
Initform

(error "")

Readers

shift-action-new-state.

Writers

(setf shift-action-new-state).

Structure: state
Package

fucc.

Source

fucc-decl.lisp.

Direct superclasses

structure-object.

Direct methods

print-object.

Direct slots
Slot: id
Type

unsigned-byte

Initform

0

Readers

state-id.

Writers

(setf state-id).

Slot: table
Type

fucc::state-row

Initform

(error "")

Readers

state-table.

Writers

(setf state-table).


Previous: , Up: Internals   [Contents][Index]

6.2.6 Types

Type: state-row ()
Package

fucc.

Source

fucc-decl.lisp.

Type: term (&optional max-term)
Package

fucc.

Source

fucc-decl.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   B   C   E   F   G   L   M   N   P   R   S   W  
Index Entry  Section

(
(setf lr-config-data-stack): Private ordinary functions
(setf lr-config-state-stack): Private ordinary functions
(setf lr-config-term-stack): Private ordinary functions
(setf reduce-action-function): Private ordinary functions
(setf reduce-action-len): Private ordinary functions
(setf reduce-action-term): Private ordinary functions
(setf shift-action-new-state): Private ordinary functions
(setf state-id): Private ordinary functions
(setf state-table): Private ordinary functions

A
accept-action-p: Private ordinary functions
action-type: Private ordinary functions
alist-to-hash-table: Private ordinary functions

B
bin-search-goto-table: Private ordinary functions

C
copy-accept-action: Private ordinary functions
copy-error-action: Private ordinary functions
copy-lr-config: Private ordinary functions
copy-reduce-action: Private ordinary functions
copy-shift-action: Private ordinary functions
copy-state: Private ordinary functions

E
error-action-p: Private ordinary functions
error-config: Private generic functions
error-config: Private generic functions
error-data: Private generic functions
error-data: Private generic functions
error-token-id: Private generic functions
error-token-id: Private generic functions

F
Function, (setf lr-config-data-stack): Private ordinary functions
Function, (setf lr-config-state-stack): Private ordinary functions
Function, (setf lr-config-term-stack): Private ordinary functions
Function, (setf reduce-action-function): Private ordinary functions
Function, (setf reduce-action-len): Private ordinary functions
Function, (setf reduce-action-term): Private ordinary functions
Function, (setf shift-action-new-state): Private ordinary functions
Function, (setf state-id): Private ordinary functions
Function, (setf state-table): Private ordinary functions
Function, accept-action-p: Private ordinary functions
Function, action-type: Private ordinary functions
Function, alist-to-hash-table: Private ordinary functions
Function, bin-search-goto-table: Private ordinary functions
Function, copy-accept-action: Private ordinary functions
Function, copy-error-action: Private ordinary functions
Function, copy-lr-config: Private ordinary functions
Function, copy-reduce-action: Private ordinary functions
Function, copy-shift-action: Private ordinary functions
Function, copy-state: Private ordinary functions
Function, error-action-p: Private ordinary functions
Function, ll-rule-actions: Private ordinary functions
Function, ll-rule-nterms: Private ordinary functions
Function, ll-terminal-p: Private ordinary functions
Function, longer-p: Private ordinary functions
Function, lr-config-data-stack: Private ordinary functions
Function, lr-config-p: Private ordinary functions
Function, lr-config-state-stack: Private ordinary functions
Function, lr-config-term-stack: Private ordinary functions
Function, make-accept-action: Private ordinary functions
Function, make-error-action: Private ordinary functions
Function, make-lr-config: Private ordinary functions
Function, make-reduce-action: Private ordinary functions
Function, make-shift-action: Private ordinary functions
Function, make-state: Private ordinary functions
Function, negative->nt: Private ordinary functions
Function, nsplit-list: Private ordinary functions
Function, nt->negative: Private ordinary functions
Function, parser-ll: Public ordinary functions
Function, parser-lr: Public ordinary functions
Function, parser-lr--reduce!: Private ordinary functions
Function, parser-lr--shift!: Private ordinary functions
Function, pop-n-stack: Private ordinary functions
Function, reduce-action-function: Private ordinary functions
Function, reduce-action-len: Private ordinary functions
Function, reduce-action-p: Private ordinary functions
Function, reduce-action-term: Private ordinary functions
Function, shift-action-new-state: Private ordinary functions
Function, shift-action-p: Private ordinary functions
Function, state-id: Private ordinary functions
Function, state-p: Private ordinary functions
Function, state-table: Private ordinary functions

G
Generic Function, error-config: Private generic functions
Generic Function, error-data: Private generic functions
Generic Function, error-token-id: Private generic functions
Generic Function, possible-actions: Private generic functions

L
ll-final-action: Private macros
ll-middle-action: Private macros
ll-rule-actions: Private ordinary functions
ll-rule-nterms: Private ordinary functions
ll-terminal-p: Private ordinary functions
longer-p: Private ordinary functions
lr-config-data-stack: Private ordinary functions
lr-config-p: Private ordinary functions
lr-config-state-stack: Private ordinary functions
lr-config-term-stack: Private ordinary functions

M
Macro, ll-final-action: Private macros
Macro, ll-middle-action: Private macros
Macro, rev-apply: Private macros
Macro, stack-popper: Private macros
Macro, with-lr-config: Private macros
make-accept-action: Private ordinary functions
make-error-action: Private ordinary functions
make-lr-config: Private ordinary functions
make-reduce-action: Private ordinary functions
make-shift-action: Private ordinary functions
make-state: Private ordinary functions
Method, error-config: Private generic functions
Method, error-data: Private generic functions
Method, error-token-id: Private generic functions
Method, possible-actions: Private generic functions
Method, print-object: Public standalone methods

N
negative->nt: Private ordinary functions
nsplit-list: Private ordinary functions
nt->negative: Private ordinary functions

P
parser-ll: Public ordinary functions
parser-lr: Public ordinary functions
parser-lr--reduce!: Private ordinary functions
parser-lr--shift!: Private ordinary functions
pop-n-stack: Private ordinary functions
possible-actions: Private generic functions
possible-actions: Private generic functions
print-object: Public standalone methods

R
reduce-action-function: Private ordinary functions
reduce-action-len: Private ordinary functions
reduce-action-p: Private ordinary functions
reduce-action-term: Private ordinary functions
rev-apply: Private macros

S
shift-action-new-state: Private ordinary functions
shift-action-p: Private ordinary functions
stack-popper: Private macros
state-id: Private ordinary functions
state-p: Private ordinary functions
state-table: Private ordinary functions

W
with-lr-config: Private macros

Jump to:   (  
A   B   C   E   F   G   L   M   N   P   R   S   W  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   A   C   E   F   L   M   P   R   S   T  
Index Entry  Section

A
accept-action: Private structures

C
Condition, lr-parse-error-condition: Public conditions
Condition, parse-conflict-condition: Private conditions
Condition, parse-error-condition: Public conditions

E
error-action: Private structures

F
File, fucc-decl.lisp: The fucc-parser/parser/fucc-decl․lisp file
File, fucc-ll.lisp: The fucc-parser/parser/fucc-ll․lisp file
File, fucc-package.lisp: The fucc-parser/parser/fucc-package․lisp file
File, fucc-parser.asd: The fucc-parser/fucc-parser․asd file
File, fucc-parser.lisp: The fucc-parser/parser/fucc-parser․lisp file
File, fucc-util.lisp: The fucc-parser/parser/fucc-util․lisp file
fucc: The fucc package
fucc-decl.lisp: The fucc-parser/parser/fucc-decl․lisp file
fucc-ll.lisp: The fucc-parser/parser/fucc-ll․lisp file
fucc-package.lisp: The fucc-parser/parser/fucc-package․lisp file
fucc-parser: The fucc-parser system
fucc-parser.asd: The fucc-parser/fucc-parser․asd file
fucc-parser.lisp: The fucc-parser/parser/fucc-parser․lisp file
fucc-util.lisp: The fucc-parser/parser/fucc-util․lisp file

L
lr-config: Private structures
lr-parse-error-condition: Public conditions

M
Module, parser: The fucc-parser/parser module

P
Package, fucc: The fucc package
parse-conflict-condition: Private conditions
parse-error-condition: Public conditions
parser: The fucc-parser/parser module

R
reduce-action: Private structures

S
shift-action: Private structures
state: Private structures
state-row: Private types
Structure, accept-action: Private structures
Structure, error-action: Private structures
Structure, lr-config: Private structures
Structure, reduce-action: Private structures
Structure, shift-action: Private structures
Structure, state: Private structures
System, fucc-parser: The fucc-parser system

T
term: Private types
Type, state-row: Private types
Type, term: Private types

Jump to:   A   C   E   F   L   M   P   R   S   T