Universe
News
- Added Function Pointers & Multi pass.
- Added typechecker
Universe
Universe is a language extension for galaxy. The extended language is implemented using the universe compiler which is downloadable from this page. The compiler converts a program written in universe to galaxy so that it can be read by sc2. Besides enabling language extensions, the compiler also performs program analysis. Detailed parsing and type errors are given. There is a lot of room for features. The ones currently implemented and those planned are shown in the features section. Usage is through the command line.
Features
- Function pointers. Functions are considered first order object in universe. As such they can be returned, given as parameters and be contained in a variable.
- Multi-pass. Universe is compiled multi-pass. Functions may refer to functions defined earlier in the code. Function prototypes need never to be defined.
- Type Checking. Various type errors are reported. This includes calling non-existing functions; defining duplicate functions; calling a function with bad arguments; returning with in incorrecy type; not specifying a constant initializer.
- Syntax Checking. The tool parses a file and reports any parsing errors. Errors show a line and column number. Some information about the error is given but I have tuned this very little.
- Block comments are allowed.
- Dynamic allocation. It is possible to use new() and destroy(). Check the dynamic allocation page for more info.
Future Features
- Polymorphism. (Actually dependant types)
- OOP concepts. Class methods that have access to the class they are defined in.
- Improved dynamic allocation. Dynamic arrays.
- Garbage collection in dynamic allocation.
- Optimizer
Bugs
Generated code is compiled by sc2 so far. However very little testing has been done. I need at least 1 user to test for me =D
I think Andromeda (http://www.sc2mod.com/board/index.php?page=Thread&threadID=13) made by geX is a viable alternative, and a much more mature product at this point.
Awesome! :D
Okay you're right. Thanks! *fixed*
What I'm saying is a statement like:
myInt=-1;
results in the precompiler thinking that =- is supposed to be an operator.
@Mishlai. Looking at the c operators on OperatorsInC I don't see "=-" on there. I think you're want to use "-=", which does parse.
Assigning a negative value results in unexpected op =-