Skip to content

Commit

Permalink
Fix some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvergnaud committed Feb 23, 2021
1 parent ddab5bc commit a370973
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 26 deletions.
7 changes: 7 additions & 0 deletions WebSite/src/web/src/language/topics/Annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class ThisTopic extends Topic {
From there, it is possible to use the widget field in widget code.<br/>
The built-in <code>ReactWidget</code> comes with 2 widget fields: name and props. See ReactWidget for examples.
</li>
<li>
<code>@WidgetProperties(<i>a document</i>)</code>
This annotation only applies to widgets. Widgets are initialized using properties, and it is convenient to be able to verify them.<br/>
The <code>@WidgetProperties</code> annotation tells prompto which properties the widget supports and their type.<br/>
From there, it is possible to verify the widget property in widget code.<br/>
See ReactWidget for examples.
</li>
</ul>
</React.Fragment>;
}
Expand Down
36 changes: 28 additions & 8 deletions WebSite/src/web/src/language/topics/Keywords.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class ThisTopic extends Topic {
<code>and</code><br/>
<code>any</code><br/>
<code>as</code><br/>
<code>asc</code><br/>
<code>ascending</code><br/>
<code>attr</code><br/>
<code>attribute</code><br/>
<code>attributes</code><br/>
Expand All @@ -36,6 +38,8 @@ class ThisTopic extends Topic {
<code>default</code><br/>
<code>define</code><br/>
<code>delete</code><br/>
<code>desc</code><br/>
<code>descending</code><br/>
<code>do</code><br/>
<code>doing</code><br/>
<code>each</code><br/>
Expand All @@ -53,10 +57,11 @@ class ThisTopic extends Topic {
<code>for</code><br/>
<code>from</code><br/>
<code>getter</code><br/>
<code>has</code><br/>
<code>if</code><br/>
<code>in</code><br/>
<code>index</code><br/>
<code>invoke</code><br/>
<code>invoke:</code><br/>
<code>is</code><br/>
<code>matching</code><br/>
<code>method</code><br/>
Expand All @@ -66,10 +71,11 @@ class ThisTopic extends Topic {
<code>native</code><br/>
<code>None</code><br/>
<code>not</code><br/>
<code>nothing</code><br/>
<code>Nothing</code><br/>
<code>null</code><br/>
<code>on</code><br/>
<code>one</code><br/>
<code>open</code><br/>
<code>operator</code><br/>
<code>or</code><br/>
<code>order</code><br/>
Expand All @@ -88,13 +94,16 @@ class ThisTopic extends Topic {
<code>sorted</code><br/>
<code>storable</code><br/>
<code>store</code><br/>
<code>super</code><br/>
<code>switch</code><br/>
<code>test</code><br/>
<code>then</code><br/>
<code>this</code><br/>
<code>throw</code><br/>
<code>to</code><br/>
<code>try</code><br/>
<code>verifying</code><br/>
<code>widget</code><br/>
<code>with</code><br/>
<code>when</code><br/>
<code>where</code><br/>
Expand All @@ -114,19 +123,23 @@ class ThisTopic extends Topic {
<code>Boolean</code><br/>
<code>Character</code><br/>
<code>Code</code><br/>
<code>Css</code><br/>
<code>Cursor</code><br/>
<code>Date</code><br/>
<code>DateTime</code><br/>
<code>Decimal</code><br/>
<code>Document</code><br/>
<code>Html</code><br/>
<code>Image</code><br/>
<code>Integer</code><br/>
<code>Iterator</code><br/>
<code>Method</code><br/>
<code>Period</code><br/>
<code>Text</code><br/>
<code>Time</code><br/>
<code>UUID</code>
<code>Type</code><br/>
<code>Uuid</code>
<code>Version</code>
</div>

<h2>Built-in attribute names</h2>
Expand All @@ -142,8 +155,9 @@ class ThisTopic extends Topic {
<code>path</code><br/>
<code>text</code><br/>
<code>timeStamp</code><br/>
<code>user</code><br/>
<code>version</code>
<code>login</code><br/>
<code>password</code><br/>
<code>email</code><br/>
</div>


Expand All @@ -154,13 +168,19 @@ class ThisTopic extends Topic {
<code>Attribute</code><br/>
<code>Buffer</code><br/>
<code>Category</code><br/>
<code>DecimalConstant</code><br/>
<code>Error</code><br/>
<code>File</code><br/>
<code>IntegerConstant</code><br/>
<code>Url</code><br/>
</div>

<h2>Built-in enumerated names</h2>

<p>The following enumerated names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:</p>
<div className="keywords">
<code>DecimalConstant</code><br/>
<code>IntegerConstant</code><br/>
<code>Error</code><br/>
</div>

<h2>Built-in symbol names</h2>

<p>The following symbol names are reserved by Prompto. Their names cannot be used for attributes, categories, methods, variables and so forth:</p>
Expand Down
5 changes: 3 additions & 2 deletions WebSite/src/web/src/language/topics/types/CssType.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ class ThisTopic extends Topic {
<li>a Prompto expression enclosed in curly braces (which must provide a valid CSS value for the property)</li>
</ul>
</li>
<li>the <code>;</code> terminator</li>
</ul>
<p> A Css literal must be enclosed in curly brackets.</p>
<pre>{String.raw`{ width: 80px; display: none } -> a simple CSS literal
{ display: { `}<i>some_value</i> }} -> a CSS literal, where the <i>value</i> for the <i>display</i> property is determined at runtime</pre>
<pre>{String.raw`{ width: 80px; display: none; } -> a simple CSS literal
{ display: { `}<i>some_value</i> }; } -> a CSS literal, where the <i>value</i> for the <i>display</i> property is determined at runtime</pre>

</React.Fragment>;
}
Expand Down
24 changes: 12 additions & 12 deletions WebSite/src/web/src/language/topics/types/Types.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ThisTopic extends Topic {

<p>Programming languages are used to manipulate all sorts of values: text, number, time, image...<br/>
Values can be provided using inline <i>literals</i>, like <code>123</code> or <code>"John"</code>.<br/>
They can be calculated from existing values, <code>123 + 456</code>.<br/>
They can be calculated from existing values, like <code>123 + 456</code>.<br/>
They can also be read from a database, from files, from the internet and so forth.<br/>
Values need to be brought into Prompto in order to be manipulated.<br/>
However, not all manipulations make sense. As an example, it is valid to
Expand All @@ -39,7 +39,7 @@ class ThisTopic extends Topic {
<pre><code>{String.raw`a = 123
a = "John"`}</code></pre>
<p>
In the above code, an integer value and a text value are successively assigned to a variabled
In the above code, an integer value and a text value are successively assigned to a variable
called <i>a</i>.<br/>
This means that the set of operations which are valid for <i>a</i> varies during execution. This is
called <i>dynamic</i> typing.<br/>
Expand All @@ -50,45 +50,45 @@ a = "John"`}</code></pre>
At Prompto, we believe that static typing is key to performance and robustness of core code which is
intensively executed of often reused.
However, we also believe that as code gets closer to the edges of an application, notably for
input qnd output, flexibility becomes more important.
input and output, flexibility becomes more important.
</p>
<h2>Dynamic typing in Prompto</h2>
<h3>Dynamic typing in Prompto</h3>
<p>Prompto supports <i>dynamic</i> typing of <a href="language/attributes.html"
target="content"><code>Document</code></a> members.</p>
<h2>Static typing in Prompto</h2>
<h3>Static typing in Prompto</h3>
<p>All other Prompto objects are statically typed.</p>

<h2>Type inference</h2>
<h3>Type inference</h3>
<p>While Prompto is mostly statically typed, it implements type <i>inference</i>, where the type of an
object is <i>inferred</i> from the context, rather than defined through declarations.
This lets developers focus on meaning rather than typing. It is however mandatory to declare the type of method arguments.</p>

<h2><i>Technical</i> types vs <i>Semantic</i> types</h2>
<h3><i>Technical</i> types vs <i>Semantic</i> types</h3>

<p>Like all programming languages, Prompto comes with built-in types for commonly used types of values.<br/>
Prompto calls these <i>technical types</i>, because they are defined by their technical structure and
behaviour.</p>

<h2>Atomic types</h2>
<h3>Atomic types</h3>
<p>Atomic types are technical types which can only hold a single 'atomic' value: Text, Integer, decimal,
Date and so forth.</p>

<h2>Collection types</h2>
<h3>Collection types</h3>
<p>Collection types are technical types which can hold multiple 'atomic' value: List, Set, Tuple and
Dictionary.</p>

<h2>Semantic types i.e. <i>Attributes</i></h2>
<h3>Semantic types i.e. <i>Attributes</i></h3>
<p>Prompto introduces <a href="language/attributes.html" target="content"><i>Attributes</i></a>,
which associate a name with a technical or composed type.<br/>
This association lets the name carry both <i>meaning</i> and <i>technical structure</i>.
</p>

<h2>Composed types</h2>
<h3>Composed types</h3>
<p>Composed types are user defined types which combine multiple <i>Attributes</i>. In Prompto, these types
are called <a href="language/categories.html" target="content"><i>Categories</i></a>.</p>


<h2>Special types</h2>
<h3>Special types</h3>
<p>Special types are technical types which do not hold meaningful values but rather serve program execution:
Iterator, Cursor, Method and so forth.</p>
<br/>
Expand Down
8 changes: 4 additions & 4 deletions WebSite/src/web/src/prompto-player/PromptoWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function translate(message) {
return {
translated: writer.toString()
};
};
}


// execute code in dialect
Expand Down Expand Up @@ -78,7 +78,7 @@ function execute(message) {
testName = decl.name;
});
// run "main" method, using fresh store
prompto.store.DataStore.instance = new prompto.memstore.MemStore();
prompto.store.$DataStore.instance = new prompto.memstore.MemStore();
if(testName)
prompto.runtime.Interpreter.interpretTest(context, testName);
else
Expand All @@ -87,7 +87,7 @@ function execute(message) {
return {
toStdOut: "Success!\n"
};
};
}

function repl(message) {
const klass = prompto.parser[message.data.dialect + "CleverParser"];
Expand Down Expand Up @@ -188,7 +188,7 @@ onmessage = function(event) {


// create global context with pre-loaded libraries
globals.librariesContext = prompto.runtime.Context.newGlobalContext();
globals.librariesContext = prompto.runtime.Context.newGlobalsContext();
resetRepl();

loadText("/prompto/prompto.pec", code => {
Expand Down

0 comments on commit a370973

Please sign in to comment.