This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a6a8d9
commit ea65c2e
Showing
7 changed files
with
145 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Plang Documents - Intrinsics Libraries</title> | ||
<link rel="stylesheet" href="css/colors.css" /> | ||
<link rel="stylesheet" href="css/main.css" /> | ||
<meta name="description" content="A simple guide to help you get started with making your own intrinsics libraries"> | ||
<meta name="keywords" content="p, p docs, plang, plang docs, p programming lang, p programming language, p-programming-language"> | ||
<meta name="author" content="Plang"> | ||
<link | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" | ||
crossorigin="anonymous" | ||
/> | ||
<script | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" | ||
crossorigin="anonymous" | ||
></script> | ||
</head> | ||
<body> | ||
<div class="body"> | ||
<div class="side-bar"> | ||
<a href="index.html"> | ||
<img | ||
class="icon" | ||
src="https://avatars.githubusercontent.com/u/146694713?s=400&u=4e01b5afefbf7e40641702e5cbdf785ff183fe35&v=4" | ||
alt="P Icon" | ||
/></a> | ||
<ul></ul> | ||
</div> | ||
<div class="page-content"> | ||
<h1 class="page-title" id="Introduction">Intrinsics Libraries</h1> | ||
<p>A simple guide to help you get started with making your own intrinsics libraries</p> | ||
<h2 id="getting-started">Getting Started</h2> | ||
<p>Looking at already existing libraries (<a href="https://github.com/p-programming-language/plang/tree/main/src/runtime/intrinsics/libs/">here</a>) can help you with this documentation</p> | ||
</div> | ||
</div> | ||
<footer class="webfooter">© Plang 2023</footer> | ||
<script src="script/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const sidebarItems = [ | ||
{ text: 'Introduction', href: 'index.html' }, | ||
{ text: 'Getting Started', href: 'getting-started.html', subitems: [ | ||
{ text: 'Installing', href: 'getting-started.html#installing' }, | ||
{ text: 'Running pint for the first time', href: 'getting-started.html#pint-first-time' }, | ||
{ text: 'Your very first P program!', href: 'getting-started.html#first-program' } | ||
] }, | ||
{ text: 'Variables', href: 'variables.html', subitems: [ | ||
{ text: 'Defining Variables', href: 'variables.html#defining-variables' }, | ||
{ text: 'Using Variables', href: 'variables.html#using-variables' } | ||
] }, | ||
{ text: 'Function', href: 'functions.html', subitems: [ | ||
{ text: 'Defining Functions', href: 'functions.html#defining-functions' }, | ||
{ text: 'Using Functions', href: 'functions.html#using-functions' } | ||
] }, | ||
{ text: 'Examples', href: 'examples.html', subitems: [ | ||
{ text: 'Fizz Buzz', href: 'examples.html#fizz-buzz' }, | ||
{ text: 'Simple HTTP Server', href: 'examples.html#http-server' }, | ||
{ text: 'Simple HTTP Request', href: 'examples.html#http-request' } | ||
] }, | ||
{ text: 'Intrinsics Libraries', href: 'intrinsics-libs.html', subitems: [ | ||
{ text: "Getting Started", href: 'intrinsics-libs.html#getting-started' } | ||
] } | ||
]; | ||
|
||
function generateSidebar() { | ||
const sidebar = document.querySelector('.side-bar ul'); | ||
|
||
sidebarItems.forEach(item => { | ||
const li = document.createElement('li'); | ||
const a = document.createElement('a'); | ||
a.textContent = item.text; | ||
a.href = item.href; | ||
li.appendChild(a); | ||
|
||
if (item.subitems) { | ||
const subul = document.createElement('ul'); | ||
item.subitems.forEach(subitem => { | ||
const subli = document.createElement('li'); | ||
const suba = document.createElement('a'); | ||
suba.textContent = subitem.text; | ||
suba.href = subitem.href; | ||
subli.appendChild(suba); | ||
subul.appendChild(subli); | ||
}); | ||
li.appendChild(subul); | ||
} | ||
|
||
sidebar.appendChild(li); | ||
}); | ||
} | ||
|
||
// Call the function to generate the sidebar | ||
generateSidebar(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Plang Documents - Variables</title> | ||
<meta name="description" content="More in depth info about using variables and defining them"> | ||
<link rel="stylesheet" href="css/colors.css"> | ||
<link rel="stylesheet" href="css/main.css"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Plang Documents - Variables</title> | ||
<meta name="description" content="More in depth info about using variables and defining them"> | ||
<link rel="stylesheet" href="css/colors.css"> | ||
<link rel="stylesheet" href="css/main.css"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" | ||
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" | ||
crossorigin="anonymous"></script> | ||
</head> | ||
|
||
<body> | ||
<div class="body"> | ||
<div class="body"> | ||
<div class="side-bar"> | ||
<a href="index.html"> | ||
<img | ||
class="icon" | ||
<img class="icon" | ||
src="https://avatars.githubusercontent.com/u/146694713?s=400&u=4e01b5afefbf7e40641702e5cbdf785ff183fe35&v=4" | ||
alt="P Icon" | ||
/></a> | ||
<ul> | ||
<li><a href="index.html">Introduction</a></li> | ||
<li><a href="getting-started.html">Getting Started</a></li> | ||
<ul> | ||
<li><a href="getting-started.html#installing">Installing</a></li> | ||
<li><a href="getting-started.html#pint-first-time">Running pint for the first time</a></li> | ||
<li><a href="getting-started.html#first-program">Your very first P program!</a></li> | ||
</ul> | ||
<li><a class="current" href="variables.html">Variables</a></li> | ||
<ul> | ||
<li><a href="variables.html#defining-variables">Defining Variables</a></li> | ||
<li><a href="variables.html#using-variables">Using Variables</a></li> | ||
</ul> | ||
<li><a href="functions.html">Function</a></li> | ||
<ul> | ||
<li><a href="functions.html#defining-functions">Defining Functions</a></li> | ||
<li><a href="functions.html#using-functions">Using Functions</a></li> | ||
</ul> | ||
<li><a href="examples.html">Examples</a></li> | ||
<ul> | ||
<li><a href="examples.html#fizz-buzz">Fizz Buzz</a></li> | ||
<li><a href="examples.html#http-server">Simple HTTP Server</a></li> | ||
<li><a href="examples.html#http-request">Simple HTTP Request</a></li> | ||
</ul> | ||
</ul> | ||
alt="P Icon" /></a> | ||
<ul></ul> | ||
</div> | ||
<div class="page-content"> | ||
<h1 class="page-title">Variables</h1> | ||
|
@@ -52,21 +32,26 @@ <h2 id="defining-variables">Defining Variables</h2> | |
<p>You can define a variable like this:</p> | ||
<code>*mut type name = value</code> | ||
<p class="highlight">(* = optional)</p> | ||
<p><strong><i>type</i></strong> can be any of these: <strong>string, int, float, bool</strong> but also custom types (more on them <a href="custom-types.html">here</a>)<br><strong><i>name</i></strong> can be any letters, numbers but not any "-" or " " in them<br><strong><i>mut</i></strong> is used to say if the variable is modifiable, basically saying if you can change the value or not. To make a variable editable you do: <code>mut type name = value</code> if not its just <code>type name = value</code></p> | ||
<p><strong><i>type</i></strong> can be any of these: <strong>string, int, float, bool</strong> but also custom | ||
types (more on them <a href="custom-types.html">here</a>)<br><strong><i>name</i></strong> can be any letters, | ||
numbers but not any "-" or " " in them<br><strong><i>mut</i></strong> is used to say if the variable is | ||
modifiable, basically saying if you can change the value or not. To make a variable editable you do: | ||
<code>mut type name = value</code> if not its just <code>type name = value</code></p> | ||
<p>An example of defining a variable called name with the value "Kevin":<code>string name = "Kevin"</code></p> | ||
<br> | ||
<h2 id="using-variables">Using Variables</h2> | ||
<p>To use a variable you can simple just call its name, example: | ||
<pre class="multiCode"> | ||
<pre class="multiCode"> | ||
use writeln from @std.io | ||
|
||
string name = "Kevin" | ||
writeln(name)</pre> | ||
<br> | ||
Output: | ||
<samp>Kevin</samp> | ||
<br> | ||
Output: | ||
<samp>Kevin</samp> | ||
</p> | ||
<p>To define a editable variable you can do: <pre class="multiCode"> | ||
<p>To define a editable variable you can do: | ||
<pre class="multiCode"> | ||
use writeln from @std.io | ||
|
||
mut age = 18 | ||
|
@@ -76,10 +61,12 @@ <h2 id="using-variables">Using Variables</h2> | |
<br> | ||
Output: | ||
<samp>I am 18 | ||
I am 19</samp> | ||
</p> | ||
I am 19</samp> | ||
</p> | ||
</div> | ||
</div> | ||
<footer class="webfooter">© Plang 2023</footer> | ||
<script src="script/main.js"></script> | ||
</body> | ||
|
||
</html> |