You are on page 1of 10

Pencil Docs 0.8A Not 0.

8A Just test pre-Alpha

PENCIL(PEN Compiled Interpreted Language) Alpha Release

Turtle Inc.

March 4, 2016
Authored by: Turtle

PENCIL DOCS 0.8A NOT 0.8A JUST TEST PRE-ALPHA


Learn how to use it and its features
What is Pencil?
Pencil stands for PEN Compiled Interpreted Language. It is called pen because pens are used
commonly for writing and drawing, and this language is about creating GUIs, just like drawing.
As its name states, it can be compiled or interpreted, providing more convenience. It can also
be packaged to Windows .exe format. Currently, it is only available for Windows, but Linux
versions are coming soon.

How to use Pictorial?

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

Simply use a text editor and type your code in. Then open the Pencil compiler or interpreter
and enter the pathname and click compile. A .penc file will be generated in compiled version
while in interpreted version it simply executes the code except that it does more complex error
checking. Afterwards, you can package the .penc file into an exe if you wish with Pencil
packager. You can download and install libraries from the Pencil repository using Pencil package
manager. Updater and IDE are still in development.

Important: Packager, package manager and interpreter are only starting in Alpha 0.8.

Changelog
Pencil 0.8 Alpha: Implemented main syntax. Solved pre-Alpha bugs.

Licences
Pencil cannot be resold or redistributed without permission. All programs made with Pencil are
under the GPLv2 License and cannot be sold. Pencil is made only using free software.
Copyright 2016 Turtle Inc.

Commands
Base Commands 55 Commands
These are commands that do not require any library. Variables are defined like this:
ABC:=abc; //Variable name followed by := then the value + ; behind.
Number

Command

Definition

Input/Output

Example

finally

Finally
statement
behind except.
Except
statement
behind try.

Commands
to
run finally after
except.
Commands
to
run once try
encounters an
error.
Import or include Library name.
library. If library
in
Pencil
distribution, use
library. Else you
must
specify
library path.
Repeat
Number of times
statement
to repeat. What
certain number to repeat.
of times.

2.

except

3.

import

4.

repeat

5.

elseif

6.

forval

7.

turtle

Turtle library

8.

while

While loop.

9.
10.
11.

break
false
array

Else if statement Commands


to
if if statement run if if or
does not sastify. previous elseif
does not sastify.
The
current Used as an input.
repeated time.

None

Statement
sastify.
Escape from loop None
Set to false.
None
Array library
None

to

try[]
except[]
finally:
try[]
except[]

import:turtle;

repeat[(4)]
<turtle.po
inter.("turtle")>
<turtle.st
amp.()>
<turtle.fo
rward.(100)>
;
if:
elseif:
elseif:
else:
repeat[(4)]
<turtle.po
inter.("turtle")>
<turtle.st
amp.()>
<turtle.fo
rward.(forval)>
;
<turtle.forward.(
90);>
while[1===1]
<break>
array.append(AR

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

1.

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

12.
13.

file
else

File library
Else statement

None
None

14.

func

Function
definition.

Parameters.

15.
16.
17.
18.
19.

true
and
=!=
===
=>=

20.

=<=

21.
22.

not
try

Set to true.
None
This and that.
None.
Not equals
None
Equals
None
More than or None
equals
Less than or None
equals
Not this.
None.
Test if works.
Code to test.

23.
24.
25.
26.
27.
28.
29.
30.

for
+=
-=
*=
/=
++
-/*

31.

*/

32.

if

33.
34.
35.
36.

or
>>
<<
//

37.
38.

(
)

For loop.
+= operator
-= operator
*= operator
/= operator
Increment
Decrement
Opening
multiline
comment
Closing multiline
comment
If else statement

RAY, a)
file.open(FILE)
if[]
else[]
func[text()]
<turtle.te
xt.("click")>
;
while[true]
if[1>2 and 2>3]
1=!=2
1===1
1=>=1
1=<=1

Code to repeat
None
None
None
None
None
None
None

not a
try[]
except[]
N/A
VAR+=90;
VAR-=90;
VAR*=90;
VAR+/=90;
VAR++
VAR-/*excluded*/

None

/*excluded*/

Command to run if[]


if true.
elif[]
This or that.
None.
More than
None
1>>2
Less than
None
1<<2
Single
line None
//hi excluded out
comment
of program
Parameters
None
<turtle.dot(1)>;
Parameters
None
<turtle.dot(1)>;

+
*
/
^

Plus operator
Minus operator
Times operator
Divide operator
Exponent
operator
Used in multiline
statements
to
separate code.

44.

45.

Used in multiline
statements
to
separate code.

46.

47.

48.

<

49.

>

50.

51.

52.

53.

<tab>

54.

<space>

55.

<newline>

List or string
indexing or list
comprehension.
List or string
indexing or list
comprehension.
Opening of any
single
line
statement.
Closing of any
single
line
statement.
Used to separate
parameters.
Ends
the
statement.
Separates import
from library.
Tab character.
Ignored.
Space character.
Ignored.
New line.
Ignored.

None
None
None
None
None

None.

None.

None.

1+1
1-1
1*1
1/1
3^7
func[text()]
<turtle.te
xt.("click")>
;
func[text()]
<turtle.te
xt.("click")>
;
List={a,b,1};
<List{2}>;
//
returns 1
List={a,b,1};
<List{2}>;
//
returns 1
<turtle.forward.(
100)>;

None.

<turtle.forward.(
100)>;

None.
None.

turtle.keypress.(t
urtle.exit., "x")
ABC:=abc;

None.

import:file;

None.

N/A

None.

N/A

None.

N/A

Turtle Commands 40 commands


These are commands that require the turtle library. Turtle is a library to draw and animate on
the screen easily with a canvas.

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

39.
40.
41
42.
43.

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

Number

Function/Method Definition

Input/Output

Example

1.

clear

None

turtle.clear.()

2.

circle

3.

stamp

4.

zeropos

5.

location

6.

forward

7.

backward

8.

right

9.

left

10.
11.

stop
start

12.

thickness

13.

color

14.

fill

Clears the turtle


canvas.
Draw a circle of
the
specified
parameters
Stamp
the
pointer on the
canvas
Move
the
pointer to the
original
start
position
Get the pointers
location
Move the pen
forward

Radius of the turtle.circle.(50)


circle in numbers
None

turtle.stamp.()

None

turtle.zeropos.()

None

turtle.location.()

Steps to move
the pen forward
in numbers
Move the pen Steps to move
backward
the
pen
backward
in
numbers
Turn the pen Degrees to turn
right by degrees the
pen
in
numbers
Turn the pen left Degrees to turn
by degrees
the
pen
in
numbers
Stop drawing
None
Continue
None
drawing
Set the thickness The thickness of
of the pen
the
pen
in
numbers
Set the color of The color of the
the pen
pen
in
hexadecimal
with a # in front
Set the fill of the The color of the

turtle.forward.(1
00)
turtle.backward.(
10)

turtle.right.(90)

turtle.left.(180)

turtle.stop.()
turtle.start.()
turtle.thickness.(
9)
turtle.color.(#A
BCDEF)

turtle.fill.(#ABC

15.

pointer

16.

text

17.

goto

18.

setx

19.

sety

20.

getx

21.

gety

22.

setrot

23.

speed

24.
25.
26.

show
hide
tracer

27.

stpoly

28.

endpoly

29.

keypress

fill
in
hexadecimal
with a # in front
Set the shape of The shape of the
the pointer
pointer which is
classic,
arrow,
turtle,
square,
triangle, blank
Show text
The text to show

DEF)

turtle.pointer.(t
urtle)

turtle.text.(turtl
e)
Move
the X
coordinate turtle.goto.(10,1
pointer to a followed by Y 00)
specified
coordinate
location
separated
by
commas
Set the x position The X coordinate turtle.setx.(0)
of the pointer
Set the y position The Y coordinate turtle.sety.(10)
of the pointer
Get
the
x None
turtle.getx.
position of the
pointer
Get
the
y None
turtle.gety.()
position of the
pointer
Set the rotation The rotation of turtle.setrot.(90)
of the pointer
the pointer in
degrees
Set the moving 1 to 10 speed turtle.speed.(10)
speed of the values, 10 is the
pointer
fastest
Show the pointer None
turtle.show.()
Hide the pointer None
turtle.hide.()
Trigger
None
turtle.show.()
animation
Start recording None
turtle.stpoly.()
moves
Ends recording None
turtle.endpoly.()
moves
What to do Commands to do turtle.keypress.(t
when specified followed by key. urtle.exit., "x")
key is pressed.
(Implemented

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

shape

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

30.

click

31.

release

32.

bgimage

33.

bgcol

34.
35.
36.

screen
reset
undo

37.

wait

38.
39.

exit
dot

40.

mainloop

but might not


work.)
What to do
when
mouse
button is clicked.
What to do
when
mouse
button
is
released.
Set
the
background
image
Set
the
background
color
Get screen.
Reset screen.
Undo previous
move on turtle
screen.
Wait
for
specified amount
of milliseconds.
Exit screen.
Create a dot of
specific size.
Prevent
the
program
from
closing
immediately
after drawing.

Commands
do.

to <turtle.click.(turt
le.goto.)>;

Commands
do.

to <turtle.release.(t
urtle.goto.)>;

Image path.

turtle.bgimage.(
C:\i.png)

Hexadecimal
color.

turtle.bgcol.(#A
BCDEF)

None.
None.
None.

turtle.screen.()
turtle.reset.()
turtle.undo.()

Time to wait in turtle.wait.()


milliseconds.
None.
Size of dot.

turtle.exit.()
turtle.dot.(10)

None.

turtle.mainloop.(
)

File Commands 4 commands


These are commands that require the file library. The file library supplies functions to deal with
files.
Number

Function/Method Definition

1.

write

Input/Output

Example

Write text to an Opened file, text <file.write.(myfil

2.

close

opened file.
Close a file.

to write.
File to close.

3.

open

Open a file.

4.

read

Read a files text.

e, "abc")>;
<file.close.(myfil
e)>;
File to open.
myfile:=file.open
.("a", "w");
Opened file to <file.read.(myfile
read.
)>;

Number

Function/Method Definition

Input/Output

Example

1.

reverse

Array

<array.reverse.(
ARRAY)>;

2.

append

Array, element

3.

extend

4.

insert

5.

remove

<array.append.(A
RRAY, 4)>;
<array.extend.(A
RRAY, 4)>;
<array.insert.(AR
RAY, 4)>;
<array.remove.(
ARRAY, 4)>;

6.

index

7.

times

8.

sort

9.

pop

Reverse
the
elements in an
array.
Append a new
element.
Extend array to a
new element.
Insert a new
element
Remove
the
specified
element.
Get the index of
the element.
Get how many
times
the
element appears
in array.
Sort an array.
Pop the
element.

Math Commands 45 commands

Array, element
Array, element
Array, element

Array, element
Array, element

Array

last Array

<array.index.(AR
RAY, 4)>;
<array.times.(AR
RAY, 4)>;

<array.sort.(ARR
AY)>;
<array.pop.(ARR
AY)>;

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

Array Commands 9 commands


These are commands that require the array library. The array library supplies functions to deal
with arrays.

These are commands that require the math library. The math library supplies math functions.
Not yet implemented. Starts in Alpha.

Time Commands 16 commands


These are commands that require the time library. The time library supplies time functions. Not
yet implemented. Starts in Alpha.

String Commands 27 commands


These are commands that require the string library. The string library supplies functions to deal
with strings. Not yet implemented. Starts in Alpha.

Pencil Docs 0.8A Not 0.8A Just test pre-Alpha | 3/4/2016

TkInter Commands
These are commands that require the TkInter library. The TkInter library is a GUI library that
enables you to draw GUI elements. Not yet implemented. Starts in Alpha.

Gamelib Commands
These are commands that require the gamelib library. The gamelib library supplies functions to
easily make games. Not yet implemented. Starts in Alpha.

Syntax
Importation of libraries and definition of variables do not need to be enclosed in <>. Other
single line statements must be enclosed in <>. Long statements such as if else, repeat and func
statements must not be enclosed in <>. A librarys name followed by a dot must be in front of
its functions name, for example turtle.location.() and turtle.click.(turtle.goto). Function inputs
are in brackets behind the function and are separated by commas. All first level statements
must be separated by a ;. Variables and functions defined can be used throughout the
program but are encouraged to start with a capital letter or might cause serious problems.

Q&A + Problems
If you spot any errors or have any queries, do go to our Help desk @ ___ on our website to post
your question. Not yet implemented. Starts in Alpha.

You might also like