From a029ab08fa78716bd3f67822f5fda9a61be53c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com> Date: Thu, 5 May 2022 07:55:15 +0200 Subject: [PATCH] Begin language doc [ci-skip] --- doc/userdoc.org | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/userdoc.org b/doc/userdoc.org index af2326604..3ef4c8f52 100644 --- a/doc/userdoc.org +++ b/doc/userdoc.org @@ -395,16 +395,36 @@ write errors. * Language -In this part we describe the grammar and data types that are - ** Variables -*** TODO Declaration +In order to simplify the presentation, before going further, we +introduce the construction that allow to print data to the +terminal. It follows ~C++~ streams construction for convenience. For +instance +#+NAME: cout-preamble-example +#+BEGIN_SRC pugs :exports both :results output + cout << "2+3 = " << 2+3 << "\n"; +#+END_SRC +produces the following output +#+results: cout-preamble-example +The code is quite obvious for ~C++~ users, note that ~"\n"~ is the +linefeed string (there is no character type in ~pugs~, just strings). + +Actually, ~cout~ is itself a variable, we will come to this later. -*** TODO Affectation +~pugs~ is a strongly typed language. It means that a variable *cannot* +change of type in its lifetime. *** TODO Basic types<<basic-types>> +Basic types in ~pugs~ are boolean ~B~, natural integers ~N~, integers ~Z~, +real ~R~, small vectors ~R^1~, ~R^2~ and ~R^3~, small matrices ~R^1x1~, ~R^2x2~ +and ~R^3x3~ and strings ~string~. + + + +*** TODO Declaration and affectation syntax + *** TODO High-level types<<high-level-types>> *** TODO Lists -- GitLab