Publications: 0 | Followers: 1

CS4800Slides

Publish on Category: Birds 268

ArcaScriptLanguage: Academic Language Grammar
CS 4800By Brandon Andrews
Introduction
SpecificationsGoalsApplicationsDesign StepsTesting
Specifications
Create the grammar for a strongly typed imperative language that merges features of common languages likeECMAscript, and C# and others.Braces languageGrammar will be in EBNF notation
Goals
To create a complete grammar for a language.Try to make it unambiguous if possible.
Applications
The languages could act as a scripting language running in a virtual machine or be compiled.I plan to use it for a scripting language for a game’s GUI.
Design
Broken the design down into parts and solved each part mostly separately.Data Types,Allocators (new/delete when not garbage collected), Constant Types, Control Structures, Namespaces, OOP (classes, methods, etc.),Iterators, Exception Handling,Threading, Function “Pointers”, Macro Preprocessor, and Remote Procedure Call functionality built into the language.
Data Types
Strongly typebool, char, string,uint,int,uint<n>,int<n>, float,double,enumTupleandNamedTupleSimple data typesConstant modifiers (apply to immediate right)Reference typesint<8>foo= 5;//can changeint<8>&foo= bar;//can changeconstint<8>foo= 5;//value can't changeint8 const&foo= bar;//reference can't// changeconstint<8> const&foo= bar; // reference and value// can't change
Control Structures
if, else, while, for, do, switch, case, default, break, continue
Namespaces
ECMAscriptand C# both have themnamespace Name { }using Name;Uses :: as the scope operator for namespaces and classes.
OOP
Normal class structurepublic, private, protected, static, abstract modifiersmodifier class Name :InheritedClass… { }
Methods
Methods with support for pass by value, reference, and name allowing automatic macro generation even at run-time.Optional and Named parametersvoidFoo(intfoo, name);Where data types without types are pass by name with explicit conversion from strings for run-time purposesTupleand “NamedTuple” return types allowing things like:return x, y; or return x:0, y:0;
Iterators
foreachmixed with the yield language feature like in C# and Python(yield can be abused, but it’s very useful).
Exception Handling
try, catch, finally, throw features
Threading
Designed in mind for user level and kernel level threads.Thread keyword with operations in it’s class namespace likeThread.Wait(10); to wait thecurrent thread.
Function Pointers
Delegate system taken from C#.
Macro Preprocessor
Language feature like#{ }Allows for compile-time and run-time compilation of code.
Remote Procedure Call
Complicated.Allows Server and Client communications seamlessly between scripts.
Testing
Manual testing using sample programs.
Conclusion
While just being the grammar for the language, the main goal later would be to implement it for actual applications.Currently most of the language features are decided upon and the style for certain parts of the grammar are designed.

0

Embed

Share

Upload

Make amazing presentation for free
CS4800Slides