Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
849d3324
Commit
849d3324
authored
29 years ago
by
Fredrik Hübinette (Hubbe)
Browse files
Options
Downloads
Patches
Plain Diff
draft for real tutorial
Rev: doc/manual/tutorial:1.1
parent
33f54679
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/manual/tutorial
+149
-0
149 additions, 0 deletions
doc/manual/tutorial
with
149 additions
and
0 deletions
doc/manual/tutorial
0 → 100644
+
149
−
0
View file @
849d3324
Contents
BEGIN(What is uLPC)
{
BEGIN(Introduction)
{
uLPC (Micro L.P.C., sometimes written ulpc or uLPC) is an interpreted,
object-oriented programming language for flexible and yet efficient
application development and prototyping. It features multiple
inheritance, data abstraction, advanced built-in datatypes, such as
associative arrays, dynamic arrays and multi-sets, and high-level
character string and array operations.
}
BEGIN(uLPC vs. C and C++)
{
uLPC syntax is very similar to C. Some things has also been borrowed
from C++. The certainly biggest differance is that uLPC is interpreted.
This gives uLPC some advantages, but also some disadvantages compared
to C:
LIST(Advantages:)
{
No compilation times
Powerful data types
}
}
BEGIN(Data types)
BEGIN(Object orientation)
}
BEGIN(Getting started)
{
BEGIN(A short example)
{
LPC
{
#!/usr/local/bin/ulpc
int main()
{
write("hello world\n");
}
}
Assume this file is called 'hello_world.lpc', then this might be seen
at your unix prompt:
PRE
{
$ ./hello_world.lpc
hello world
$
}
}
BEGIN(Line by line)
{
The first line is a unix-trick which causes /usr/local/bin/ulpc to run
the hello world program for you when you type it's name at the unix
prompt.
}
BEGIN(variables)
BEGIN(loops)
}
BEGIN(Program structure)
{
BEGIN(functions)
BEGIN(Loops)
{
BEGIN(while)
BEGIN(for)
BEGIN(do-while)
BEGIN(foreach)
}
BEGIN(Skips and Jumps)
{
BEGIN(if)
BEGIN(switch)
BEGIN(continue)
BEGIN(break)
}
}
BEGIN(objects and programs)
{
BEGIN(variable spaces)
BEGIN(inheritance)
{
BEGIN(multiple inheritance)
}
}
BEGIN(data types)
{
BEGIN(int)
{
Ints, or <integers> are simple whole numbers 0, 1, 2 ... They are fast
and used for all arethmics where fractions of numbers aren't needed.
}
BEGIN(float)
{
Floats can be used to represent any number, not just whole numbers.
Floats are slower than integers and can not be used where a whole
number is expected. (When indexing an array for instance.) Floats
are commonly used for mathematical calulations such as averages and
trigonometrics.
}
BEGIN(string)
{
Strings hold text, or more precicely; sequences of 8-bit characters.
Strings can be manipulated in many ways, the simples of which is
<indexing>; picking out the ascii value of one of the characters in
the string.
}
BEGIN(array)
{
Arrays simply hold values.
}
BEGIN(mapping)
{
Mappings, or associative arrays, work similar to arrays, but can be
indexed on any type of value, not just integers.
}
BEGIN(list)
{
A list is essentially what mathematicians call a 'set'. It is a bunch
of values without any particular order. Arrays could replace lists
in all respects but one: lists are much faster.
}
BEGIN(object)
{
Objects hold data.
}
BEGIN(program)
{
Programs are the templates for objects.
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment