The YaST Programming Language - YCP


Table of Contents

1. The First YCP Program
1.1. YCP Source
1.2. The YCP compiler
1.3. Running YCP
2. YCP Data Types
2.1. Data Type void (nil)
2.2. Data Type symbol
2.3. Data Type boolean
2.4. Data Type integer
2.5. Data Type float
2.6. Data Type string
2.7. Data Type byteblock
2.8. Data Type list
2.9. Data Type map
2.10. Data Type path
2.11. Data Type term
2.12. Data Type any
3. More YCP types
3.1. Data Type block
4. YCP Type System
4.1. Data Type any And Type Checking
5. YCP Expression Evaluation
5.1. Evaluation Of Blocks
5.2. Evaluation Of Basic Data Types
6. YCP Operators
6.1. Comparison Operators
6.2. Boolean Operators
6.3. Bit Operators
6.4. Math Operators
6.5. Triple Operator
6.6. Operators Precedence
6.7. The bracket operator
7. Data Type locale
8. YCP Program Structure
8.1. Comments
8.2. Variable Declaration
8.3. Variable Assignment
8.4. Conditional Branch
8.5. while() Loop
8.6. do..while() Loop
8.7. repeat..until() Loop
8.8. break Statement
8.9. continue Statement
8.10. return Statement
8.11. Function definition
8.12. Function declaration
8.13. include Statement
8.14. import Statement
8.15. Variable Scopes and blocks
8.16. Applying Expressions To Lists And Maps
9. Controlling The User Interface
10. The YaST Wizard
11. Running y2base Stand-Alone

The YaST-language YCP is a scripting language to be interpreted by the YCP-engine (YCP interpreter) specially designed for manipulation with a system configuration. Its syntax is very similar to C programming language. Because YCP can make use of the whole infrastructure that YaST provides, the actions that can be accomplished with YCP are very powerful.

YCP has the usual features of procedural languages and some more, partially originating from the functional programming paradigm:

On the following pages we will explore the YCP language definition and find out how to use YCP to write “programs” that can be executed by YaST.