EMal is a new programming language that wants to be easy to understand and read.
I would like to introduce my kids to programming with this language, and I want to use it for my job in order to
prototype algorithms and test REST services.
The language is expressive and has a gradual type system.
It supports double grammar with english and italian keywords.
Execution speed is slow and is not a goal for EMal.
It's written in c#, because I use it for my daily work, and writing a new language stresses my skills.
The development is ongoing, but it's still in alpha status.
You can access working examples at https://rosettacode.org/wiki/Category:EMal
It can happen that I release binary versions more often than the sources.
Below I link the project changelog and the project status for every class involved.
(*
* @(#) changelog.eg 0.0.4 24/09/2024
*
* Copyright 2020,2021,2022,2023,2024 Alberto Innocenti <lanky at tiscali dot it>
*
* Licensed under the General Shared Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.lanky.eu/licenses/LICENSE-1.1
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* Consequently, Your use, modification and distribution of this source code is
* entirely at Your own risk and neither the Licensor, its licensors nor any
* other person who has contributed to this Source code shall be liable to You
* for any loss or damage which You may suffer as a result of Your use,
* modification or distribution of this Source code.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*)
(*
* EMal changelog
*
* @version 0.0.4
* @status alpha
* @author Alberto Innocenti
* @changelog
* 2024-09-24(0.0.4) updates from 0.0.112 to 0.0.144
* 2024-05-24(0.0.3) updates from 0.0.83 to 0.0.112
* 2023-07-23(0.0.2) improved the layout
* 2023-07-21(0.0.1) first documented version
* @notes
* t values:
* 'B' binary
* 'S' source
* 'X' binary+source
* ' ' internal
*)
[_Changelog]
!release _|t|comment |
!--------------------_|-|----------------------------------------------------------------|
!2024-09-24(0.0.144) _|B|ready for a new binary-only release |
! _| |API CHANGE removed average() |
! _| |not a math function, it won't be used in that way. |
! _| |It's a grouping function and should be called avg. |
! _| |But we are happy without it. |
! _| |◇ synonym for <> |
! _| |API CHANGE finally added List.fold |
! _| |fixed comparison between integers and reals. |
! _| |removed a PSOD, comparing (<, <=, >, >=, <>) sent an |
! _| |unreported exception when data types are different. |
! _| |Now at least we have managed the exception. |
! _| |This can still be a problem. |
! _| |API CHANGE added average() |
! _| |API CHANGE added writeParts. |
! _| |now writeParts, write, writeLine accept multiple values. |
! _| |The EmalObject basic IO has been reviewed. |
! _| |managed alias ⇒ for => |
! _| |evaluating if this symbol ⇒ could be used as an alias for => |
! _| |fixed a PSOD because of a NPE with exit() |
! _| |no more Record.typed, we use instantiation for this. |
! _| |Record can be instantiated: |
! _| |Record auth = ... |
! _| |var pippo = auth(1, "pippo", "secret0") |
! _| |managed a PSOD while reading NativeCode |
! _| |symbolic references are not oly for functions, |
! _| |BREAKING CHANGE |
! _| |now var("name") returns the symbolic reference |
! _| |of the variable named "name" |
! _| |improved named functions for accepting me. and Klass. |
! _| |added the new feature to have named functions |
! _| |added hex method hex(65, 4) = "0x0041" |
! _| |added the method changeTimer, improved few errors |
! _| |fun num = int by block do return 12 end |
! _| |int a = num()++ |
! _| |This code must throw an error, but was too much generic. |
! _| |Set is again in the standard collection library |
! _| |swap is a collection method implemented in |
! _| |Blob, Text, List, Map; before it was only present in List. |
! _| |Reviewing the Timer interface |
! _| |libMessaging review still in progress. |
! _| |going on improving Posix, |
! _| |changes in the TypeSystem in order to get IntegerValues as uint |
! _| |check the libMessaging project, added unit tests and first |
! _| |classes marked as beta. |
! _| |first stub of Posix |
! _| |Locate() returns a pair named y,x the current cursor position |
! _| |BREAKING CHANGE locate(x,y) now is locate(y,x) |
! _| |code review againts the 2024-05-20 version, |
! _| |bugfix logarithm operator was wrong |
! _| |BREAKING CHANGE |
! _| |watch(3 ** 2) # "what is 3 squared?": 32 = 9 |
! _| |watch(2 // 9) # "what is the square root of 9?": √9 = 3 |
! _| |watch(3 %% 9) # "what is log base 3 of 9?": log3(9) = 2 |
! _| |watch(3²) |
! _| |watch(3³) |
! _| |watch(√9) |
! _| |watch(∛27) |
! _| |IScreenPort and ITimerPort have been used. |
! _| |first code with IScreenPort, still work in progress... |
! _| |the timer has been backported from ConsoleHardware |
! _| |added hasKeys, flushKeys |
!2024-05-24(0.0.112) _|X|ready for a new alpha release |
! _| |bugfix in multiline comments not properly resetting the state |
! _| |after double arrow we can insert a new line |
! _| |API breaking changes for methods that use keyboard and log |
! _| |no more read that now is press |
! _| |no more keyboard that now is startKeyDown |
! _| |added copyright 2024, no code changes. |
! _| |Emal.color now has an overload with 0 parameters, to restore |
! _| |the background and foreground colors. It uses proper checks now |
! _| |ExitException moved under reporting with name SystemExit |
! _| |Emal class changed the way is constructed. It will allow to |
! _| |dinamically set visitors different from Evaluator |
! _| |we can interact with environment variables |
! _| |renamed Text.empty to Text.EMPTY, removed PSOD in Map |
! _| |added the following single glyph ← ≠ æ ≥ ≤ |
! _| |Pair and List should have trapped all the exceptions |
! _| |removed a lot of PSOD in the List class |
! _| |bugfix in the tokenzier, while handling new lines |
! _| |removed many possible PSOD in TextObject |
! _| |all libEmalDataStructer is stable, |
! _| |make the NameAliasPair enum readonly |
! _| |All the collection supports the list(delegate) overload |
! _| |bugfix release in multikeydictionary renamekey there was a bug |
! _| |bugfix release, parser had a bug with lambda some keyword |
! _| |bugfix release multiline and zformat were not unset |
! _| |big change strings are now multiline |
! _| |we have also added a zformat mode introduced by \z |
! _| |changed the tokenizer to support perl escape sequences |
! _| |we have an overloaded list now, no more every or forEach |
! _| |added the title method |
! _| |changed to general shared source license 1.2, few bugixes |
! _| |UnitTest was in error, now is fixed |
! _| |logo updated to 0.0.8, tried to replace decimal with doubles |
!2023-07-21(0.0.83) _|X|no code changes, improved the logo |
!2023-07-14(0.0.82) _| |added list.zip, Generic.check |
!2023-07-13(0.0.81) _| |added list.filer(predicate) |
!2023-07-13(0.0.80) _| |enumerations asText and list, added Generic.name |
!2023-07-13(0.0.79) _| |list expansion is one shot, after passing the list is toggled |
! _| |back to unexpanded. |
!2023-07-13(0.0.78) _| |no more Extend in Reference, some code refactor |
!2023-07-12(0.0.77) _| |big change *** RISKY *** added HasProperty, so that we can |
! _| |be more introspective, this can be already seen by |
! _| |Generic.has/Generic.property for querying static properties |
! _| |Value.Function now accepts only: |
! _| |StaticMethod, InstanceMethod, WrapperMethod as it should, |
! _| |Reference has removed some stuff that has been propery moved in |
! _| |the Wrapper class |
!2023-07-10(0.0.76) _| |now we have Generic.property, we still need Generic.has |
!2023-07-07(0.0.75) _| |removed a PSOD in map.insert, now we have typed Record |
! _| |this is a new feature! |
!2023-07-04(0.0.74) _| |no more dll load, we always need an emal file, it's clean. |
! _| |removed another PSOD in the evauator,while loading external dll |
!2023-07-03(0.0.73) _| |a change in the unix include fallback dir that now points to |
! _| |/opt/emal/lib/emal, fixed a Purple Screen Of Death (PSOD) |
!2023-06-28(0.0.72) _| |reviewed the include hiearchy to be cross-platform |
!2023-06-25(0.0.71) _| |MakeText/MakeBlob have been recoded, internal changes in |
! _| |the libEmalStandard |
!2023-06-23(0.0.70) _| |the with method has been added to the containers |
! _| |(texts, blobs, lists, maps) |
! _| |one less purple screen of death, minor change to the EMal guy |
!2023-06-23(0.0.69) _| |added "with" method on maps, added error(int, text), |
! _| |fixed a bug in the tokenizer |
[end]
(*§*)
(*
* @(#) status.eg 0.0.21 29/07/2024
*
* Copyright 2020,2021,2022,2023,2024 Alberto Innocenti <lanky at tiscali dot it>
*
* Licensed under the General Shared Source License, Version 1.2 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.lanky.eu/licenses/LICENSE-1.2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* Consequently, Your use, modification and distribution of this source code is
* entirely at Your own risk and neither the Licensor, its licensors nor any
* other person who has contributed to this Source code shall be liable to You
* for any loss or damage which You may suffer as a result of Your use,
* modification or distribution of this Source code.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
*)
(*
* EMal project status
*
* @version 0.0.21
* @status alpha
* @author Alberto Innocenti
* @changelog
* 2024-07-29(0.0.21) Set added again to the project.
* 2024-07-28(0.0.20) working on libEmalMessaging, added the external libraries
* 2024-06-10(0.0.19) added Rooting
* 2024-05-28(0.0.18) added IScreenPort
* 2024-05-27(0.0.17) added ITimerPort
* 2024-05-22(0.0.16) starting backport from ConsoleHardware, refined Log and Keyboard
* drivers, used the shortcut for consuming less resources.
* 2023-11-13(0.0.15) ExitException + SysExit = SystemExit
* 2023-10-14(0.0.14) working in the Standard library to make it safer
* 2023-10-09(0.0.13) libEmalDataStructure is stable
* 2023-09-05(0.0.12) changed to license 1.2, added Tap.cs
* 2023-07-13(0.0.11) added Wrapper and WrapperMethod
* 2023-07-04(0.0.10) removed NullPort, added TypeSignature, resync with sources
* 2023-06-26(0.0.9) adapted to changes in libEmalStandard
* 2023-06-22(0.0.8) removed Set, now lives in the external library
* 2023-05-16(0.0.7) no more libEmalCore in order to better test the modules
* 2023-05-03(0.0.6) no more emscii
* 2023-03-27(0.0.5) re-checkd after libEmalSymbols split
* 2023-03-08(0.0.4) updated to reflect the actual status
* 2023-02-04(0.0.3) house-keeping for base, typesystem, status they must be the Emal fortress
* 2022-12-22(0.0.2) changed BoxValut to VariableValue
* 2022-12-09(0.0.1) first documented version
* @notes
* emal linkyzer.emal ..\..\..\documents\status.eg > ..\..\..\documents\status.html
*)
[_libEmalDataStructure]
(* *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!DataStructure/NameAliasPair.cs _|====|====|==..|
!DataStructure/AppendDictionary.cs _|====|====|=...|
!DataStructure/MultiKeyDictionary.cs _|====|====|==..|
!DataStructure/DynamicString.cs _|====|====|==..|
!DataStructure/DynamicByteArray.cs _|====|====|==..|
[_libEmalReporting]
(* libEmalDataStructure *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Reporting/Component.cs _|====|====|=...|
!Reporting/IWatchable.cs _|====|====|=...|
!Reporting/Severity.cs _|====|====|=...|
!Reporting/SystemExit.cs _|====|====|=...|
!Reporting/WatchPoint.cs _|====|====|=...|
!Reporting/Kind.cs _|====|=...|....|
!Reporting/Problem.cs _|====|====|=...|
!Reporting/PreprocessorProblem.cs _|====|====|=...|
!Reporting/LexingProblem.cs _|====|====|=...|
!Reporting/ParsingProblem.cs _|====|====|=...|
!Reporting/ExecutionProblem.cs _|====|=...|....|
!Reporting/TypeSystemProblem.cs _|====|=...|....|
!Reporting/BindingProblem.cs _|==..|....|....|
[_libEmalLexing]
(* libEmalDataStructure, libEmalReporting *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Lexing/Lexeme.cs _|====|====|....|
!Lexing/Translate.cs _|====|==..|....|
[_libEmalTypeSystem]
(* libEmalDataStructure, libEmalReporting, libEmalLexing *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!TypeSystem/Reference.cs _|====|=...|....|
!TypeSystem/Wrapper.cs _|==..|....|....|
!TypeSystem/Value.cs _|====|=...|....|
!TypeSystem/HeapValue.cs _|====|=...|....|
!TypeSystem/GenericValue.cs _|====|=...|....|
!TypeSystem/VoidValue.cs _|====|=...|....|
!TypeSystem/LogicalValue.cs _|====|=...|....|
!TypeSystem/IntegerValue.cs _|====|....|....|
!TypeSystem/RealValue.cs _|====|....|....|
!TypeSystem/TextValue.cs _|===.|....|....|
!TypeSystem/BlobValue.cs _|===.|....|....|
!TypeSystem/VariableValue.cs _|====|==..|....|
!TypeSystem/FunctionValue.cs _|====|=...|....|
!TypeSystem/ReferenceValue.cs _|===.|....|....|
[_libEmalSymbols]
(* libEmalDataStructure, libEmalReporting, libEmalLexing, libEmalTypeSystem *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Symbols/Frame.cs _|====|====|....|
!Symbols/Scope.cs _|====|===.|....|
[_libEmalStatus]
(* libEmalDataStructure, libEmalReporting, libEmalLexing, libEmalTypeSystem *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Status/TypeSignature.cs _|===.|....|....|
!Status/TypeInfo.cs _|====|=...|....|
!Status/TypeCatalog.cs _|====|....|....|
!Status/Module.cs _|====|==..|....|
!Status/LoadChain.cs _|====|====|....|
!Status/Registry.cs _|====|=...|....|
!Ast/Addition.cs _|====|===.|....|
!Ast/Assignment.cs _|====|===.|....|
!Ast/BinaryOperator.cs _|====|===.|....|
!Ast/BitwiseAnd.cs _|====|===.|....|
!Ast/BitwiseNot.cs _|====|===.|....|
!Ast/BitwiseOr.cs _|====|===.|....|
!Ast/BitwiseXor.cs _|====|===.|....|
!Ast/Block.cs _|====|===.|....|
!Ast/Compare.cs _|====|===.|....|
!Ast/Conditional.cs _|====|=...|....|
!Ast/Container.cs _|====|===.|....|
!Ast/DataType.cs _|====|===.|....|
!Ast/Declaration.cs _|====|===.|....|
!Ast/Division.cs _|====|===.|....|
!Ast/EndOfCode.cs _|====|===.|....|
!Ast/Ephemeral.cs _|====|===.|....|
!Ast/Equality.cs _|====|===.|....|
!Ast/Exit.cs _|====|===.|....|
!Ast/Exponentation.cs _|====|===.|....|
!Ast/Expression.cs _|====|===.|....|
!Ast/Function.cs _|====|===.|....|
!Ast/Greater.cs _|====|===.|....|
!Ast/GreaterEqual.cs _|====|===.|....|
!Ast/IContextProvider.cs _|====|=...|....|
!Ast/Identifier.cs _|====|===.|....|
!Ast/Indexer.cs _|====|==..|....|
!Ast/Inequality.cs _|====|===.|....|
!Ast/InstanceProperty.cs _|====|==..|....|
!Ast/Instantiation.cs _|====|===.|....|
!Ast/Invocation.cs _|====|====|....|
!Ast/Iteration.cs _|====|===.|....|
!Ast/IVisitor.cs _|====|==..|....|
!Ast/Jump.cs _|====|===.|....|
!Ast/Klass.cs _|====|===.|....|
!Ast/KlassProperty.cs _|====|===.|....|
!Ast/Konvert.cs _|====|===.|....|
!Ast/LeftShift.cs _|====|===.|....|
!Ast/Less.cs _|====|===.|....|
!Ast/LessEqual.cs _|====|===.|....|
!Ast/Literal.cs _|====|===.|....|
!Ast/Logarithmization.cs _|==..|....|....|
!Ast/Multiplication.cs _|====|===.|....|
!Ast/NativeCode.cs _|====|===.|....|
!Ast/Node.cs _|====|===.|....|
!Ast/Operator.cs _|====|===.|....|
!Ast/PostDecrement.cs _|====|===.|....|
!Ast/PostIncrement.cs _|====|===.|....|
!Ast/PreDecrement.cs _|====|===.|....|
!Ast/PreIncrement.cs _|====|===.|....|
!Ast/Remainder.cs _|====|===.|....|
!Ast/Return.cs _|====|===.|....|
!Ast/RightShift.cs _|====|===.|....|
!Ast/Rooting.cs _|==..|....|....|
!Ast/Selection.cs _|====|====|....|
!Ast/Statement.cs _|====|===.|....|
!Ast/Subtraction.cs _|====|===.|....|
!Ast/TraversableType.cs _|====|===.|....|
!Ast/TryRemedy.cs _|====|===.|....|
!Ast/UnaryMinus.cs _|====|===.|....|
!Ast/UnaryOperator.cs _|====|===.|....|
!Ast/UnaryPlus.cs _|====|===.|....|
[_libEmalFrontend]
(* libEmalDataStructure, libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Frontend/Host.cs _|====|====|=...|
!Frontend/BlockComment.cs _|====|==..|....|
!Frontend/NodeQueue.cs _|====|==..|....|
!Frontend/Preprocessor.cs _|====|=...|....|
!Frontend/Tokenizer.cs _|====|=...|....|
!Frontend/Parser.cs _|====|....|....|
[_libEmalMessaging]
(* libEmalDataStructure, libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Messaging/Event.cs _|====|=...|....|
!Messaging/IPort.cs _|====|=...|....|
!Messaging/Port.cs _|====|=...|....|
!Messaging/ILogPort.cs _|====|=...|....|
!Messaging/LogAddress.cs _|====|=...|....|
!Messaging/IKeyboardPort.cs _|====|=...|....|
!Messaging/KeyboardAddress.cs _|====|=...|....|
!Messaging/ITimerPort.cs _|==..|....|....|
!Messaging/TimerAddress.cs _|==..|....|....|
!Messaging/IScreenPort.cs _|=...|....|....|
!Messaging/ScreenAddress.cs _|=...|....|....|
!Messaging/Bus.cs _|=...|....|....|
!Messaging/Logger.cs _|=...|....|....|
[_libEmalStandard]
(* libEmalDataStrucute, libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus, libEmalSymbols, libEmalMessaging *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Library/LibraryObject.cs _|====|=...|....|
!Library/NativeObject.cs _|=...|....|....|
!Library/InstanceMethod.cs _|====|....|....|
!Library/StaticMethod.cs _|====|....|....|
!Library/WrapperMethod.cs _|====|....|....|
!Standard/EventObject.cs _|==..|....|....|
!Standard/PortObject.cs _|==..|....|....|
!Standard/RuntimeObject.cs _|====|=...|....|
!Standard/EmalObject.cs _|==..|....|....|
!Collection/TextObject.cs _|===.|....|....|
!Collection/BlobObject.cs _|=...|....|....|
!Collection/PairObject.cs _|====|=...|....|
!Collection/ListObject.cs _|===.|....|....|
!Collection/MapObject.cs _|==..|....|....|
!Collection/SetObject.cs _|=...|....|....|
!Collection/RecordObject.cs _|=...|....|....|
[_libEmalInterpreter]
(* libEmalDataStructure, libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus, libEmalSymbols, libEmalMessaging, libEmalStandard *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Interpreter/BreakException.cs _|====|====|=...|
!Interpreter/ContinueException.cs _|====|====|=...|
!Interpreter/ReturnException.cs _|====|====|=...|
!Interpreter/ListExtension.cs _|==..|....|....|
!Interpreter/InternalMethod.cs _|==..|....|....|
!Interpreter/GenericObject.cs _|==..|....|....|
!Interpreter/Evaluator.cs _|==..|....|....|
[_libEmal]
(* libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus, libEmalMessaging, libEmalFrontend, libEmalInterpreter *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Emal.cs _|==..|....|....|
[_emaltest]
(* libEmalDataStructure, libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus, libEmalSymbols, libEmalMessaging, libEmalFrontend, libEmalStandard, libEmalInterpreter, libEmal *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!emal/Tap.cs _|=...|....|....|
!emal/UnitTest.cs _|=...|....|....|
!emal/Program.cs _|===.|....|....|
[_emal]
(* libEmalReporting, libEmalLexing, libEmalTypeSystem, libEmalStatus, libEmalSymbols, libEmalMessaging, libEmalFrontend, libEmalStandard, libEmalInterpreter, libEmal *)
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!emal/Ports/LogPort.cs _|==..|....|....|
!emal/Ports/KeyProducer.cs _|==..|....|....|
!emal/Ports/KeyboardPort.cs _|==..|....|....|
!emal/Ports/ClockInterrupt.cs _|=...|....|....|
!emal/Ports/TimeProducer.cs _|=...|....|....|
!emal/Ports/TimerPort.cs _|=...|....|....|
!emal/Ports/UnixScreenPort.cs _|=...|....|....|
!emal/Ports/ScreenPort.cs _|=...|....|....|
!emal/Command.cs _|=...|....|....|
!emal/Program.cs _|====|====|==..|
[_funEmalCollectionSet]
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Set.cs _|=...|....|....|
[_funEmalExample]
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Example.cs _|=...|....|....|
[_funEmalIoFile]
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!File.cs _|=...|....|....|
[_funEmalNetRestClient]
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!RestClient.cs _|=...|....|....|
[_funEmalPosix]
!source _|alfa|beta|stab|
!------------------------------------------------_|----|----|----|
!Posix.cs _|=...|....|....|
[end]
(*§*)