Advertisement
GeneralGuy4872

MyLanguage

Nov 11th, 2018
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.99 KB | None | 0 0
  1. Moved permanently https://github.com/GeneralGuy4872/ByMyBootstraps
  2. My Language V0.1.16a 0000000 00-00-0000
  3. Prealpha
  4. ======================================
  5.  
  6. Caution: early versions will probably be about as stable as a house of cards built atop of jenga towers sitting on a card table.
  7. Code accordingly.
  8.  
  9. FUNCTIONS
  10. ---------
  11.  
  12. as a general rule:
  13. - a function in ALL CAPS is a binary operator, which returns it's result, or a control function, which doesn't return.
  14. - infix symbols are binary operators as above
  15. - prefix symbols change how the thing they are attatched to is interpreted
  16. - postfix symbols change a variable in place
  17. - a function in lowercase needs it's arguments in (parenthases), and has it's return specified
  18. - a symbol is a binary operator or a unary operator, and returns it's result
  19. any returned array will be 1 dimensional.
  20.  
  21. My language will have the following functions:
  22.  
  23. wait(foo) : wait for foo milliseconds, returns void
  24. time() : returns the current real time, timtyp
  25. clock() : return the current program time, clktyp
  26. beep() : print \a, returns void
  27. donothing() : does nothing, optimised out
  28.  
  29. IF (foo) {} : if foo is true, do the function enclosed in {}.
  30. ELSE {} : if the function if fails, do the function enclosed in {}.
  31. WHILE (foo) {} : loop the function enclosed in {} until foo is false.
  32. BREAK : immediately exit the current loop
  33. GOTO (foo) : go to label foo. NOTE: there is no return function. putting a goto inside a function declaration can screw up your control flow.
  34. DOTIMES (foo) {} : do whatever is in {} foo times. if foo is a float, rounds down. if foo is infinity, you're trying too hard.
  35. MAP (foo, bar) {} : for array or linked list foo, do whatever is in {} where bar is the local variable
  36. ¶foo : a label called foo. Please don't put these INSIDE loops unless you know what you're doing.
  37.  
  38. printf(...) : print a formatted value to stdout, as in C. returns as in C. Formats as in C.
  39. sprintf(...) : print a formatted value to variable, as in C. returns as in C. Formats as in C.
  40. fprintf(...) : append a formatted value to file, as in C. returns as in C. Formats as in C.
  41. scanf(...) : get a value matching format from stdin, as in C. returns as in C. Formats as in C.
  42. sscanf(...) : get a value matching format from a string, as in C. returns as in C. Formats as in C.
  43. fscanf(...) : get a value matching format from file, as in C. returns as in C. Formats as in C.
  44. fflush(...) : flush an output file, as in C. returns as in C. Formats as in C.
  45. fopen(...) : open a file as a stream, as in C. returns as in C. Formats as in C.
  46. fclose(...) : close a stream, as in C. returns as in C. Formats as in C.
  47. fseek(...) : go to an offset in a file, as in C. returns as in C. Formats as in C.
  48. ftell(...) : get the current offset in a file, as in C. returns as in C. Formats as in C.
  49. rewind(...) : go to the beginning of a file, as in C. returns as in C. Formats as in C.
  50.  
  51. write(...) : write to a file, as in Pascal. returns as in Pascal. Formats as in Pascal.
  52. writeln(...) : write to a file, as in Pascal. returns as in Pascal. Formats as in Pascal.
  53. read(...) : write to a file, as in Pascal. returns as in Pascal. Formats as in Pascal.
  54. readln(...) : write to a file, as in Pascal. returns as in Pascal. Formats as in Pascal.
  55.  
  56. FUNCTION foo(...) {...} : define a function foo. () contains an exaustive list of the internal names of arguments, {} contains the function itself.
  57. VARIADIC foo(bar) {...} : define a function foo. bar is an array of arguments, {} contains the function itself.
  58. EXTERN foo(...) : define an external function that takes standard linkage.
  59. TYPE FOO bar : define a datatype FOO, whereas FOO is a literal string of case insensitive letters or underscores and bar is number between 0 and CPU maximum (assumed to be 64) specifying bit width which may be prefixed by a U or S to indicate signing, and may be followed by a * to denote repeating units
  60. FOO bar, quux, xyzzy : where FOO is a valid datatype, make variables bar, quux, and xyzzy that type
  61. UNDECLARE bar, quux, xyzzy : unlink the names bar, quux, and xyzzy from the address they point to. the values can still be retrieved with direct addressing methods.
  62. ARRAY foo[bar] {...} : make an array foo of size bar. More square brackets can be added as quux[xyzzy][plugh][waldo] to define a multi dimensional array.
  63. foo[bar][quux] : the quux-th element of the bar-th column of array foo
  64. STRUCT FOO {...} : create a structured datatype FOO with the keys named in {}.
  65. foo.bar : the field bar from the variable foo, where foo is a structure. foo.bar is not a valid variable name otherwise because of this syntax, use foo_bar.
  66. LLIST foo {...} : create a linked list of nodes with .data fields containing the values in {} in reverse order
  67.  
  68. #include "/path/to/foo" : add the entire file foo here.
  69. #define foo bar : replace all regex foo with regex bar
  70. and so on as in the C preprocessor
  71.  
  72. ; : equivilant to new line
  73. EXIT : close the program immidiately
  74.  
  75. math types noted below
  76. foo + bar : foo plus bar
  77. foo - bar : foo minus bar
  78. -foo : foo times -1
  79. foo * bar , foo × bar : foo times bar
  80. foo / bar , foo ÷ bar : foo over bar
  81. foo ^ bar , foo ** bar , foo ⋆ bar : foo to the power of bar
  82. foo ^^ bar : tertiation, foo raised to foo bar times
  83. foo % bar : foo modulus bar
  84. foo LOG bar , foo ⍟ bar : logarithem of bar to base foo
  85. foo ROOT bar , foo √ bar : foo root bar
  86. !foo : foo factorial
  87. ¡foo : foo derangement
  88. foo nCr bar : combinations of foo elements from bar items
  89. foo nPr bar : permutations of foo elements from bar items
  90.  
  91. elog(foo) : the natural logarithem of foo
  92. abs(foo) : absolute value of number foo. returns according to mathtypes
  93. cabs(foo) : the complex absolute value of foo.
  94. floor(foo) : floor of number foo, returns shortest int format possible
  95. ceiling(foo) : ceiling of number foo, returns shortest int format possible
  96. div(foo, bar) : divide int over bar. returns divtyp.
  97. elog(foo) : natural logarithem of foo
  98. sqrt(foo) : the square root of foo
  99. cbrt(foo) : the cube root of foo
  100.  
  101. max(foo, bar...) : return the greatest value of numbers foo and bar. returns that number.
  102. min(foo, bar...) : return the least value of numbers foo and bar. returns that number.
  103. mean(foo, bar...) : find the adverage of numbers foo and bar. returns according to mathtypes
  104. median(foo, bar...) : find the median of a list of values. returns according to mathtypes
  105. mode(foo, bar) : find the mode of a list of values. returns according to mathtypes
  106.  
  107. sin(foo) : the sine of foo, returns float
  108. cos(foo) : the cosine of foo, returns float
  109. tan(foo) : the tangent of foo, returns float
  110. cot(foo) : the cotangent of foo, returns float
  111. sec(foo) : the secant of foo, returns float
  112. csc(foo) : the cosecant of foo, returns float
  113. arcsin(foo) : the arcsine of foo, returns float
  114. arccos(foo) : the arccosine of foo, returns float
  115. arctan(foo) : the arctangent of foo, returns float
  116. arccot(foo) : the arccotangent of foo, returns float
  117. arcsec(foo) : the arcsecant of foo, returns float
  118. arccsc(foo) : the arccosecant of foo, returns float
  119.  
  120. foo++ : foo + 1
  121. foo-- : foo - 1
  122. foo>> : barrel shift foo to the right by one (left on big endian systems)
  123. foo<< : barrel shift foo to the left by one (right on big endian systems)
  124. foo-> : shift foo to the right by one, drop excess (left on big endian systems)
  125. foo<- : shift foo to the left by one, drop excess (right on big endian systems)
  126.  
  127. `foo : bitwise inverse of foo, returns result
  128. foo ∧ bar , foo AND bar , foo & bar : bitwise foo AND bar, returns result
  129. foo ∨ bar , foo OR bar , foo | bar : bitwise foo OR bar, returns result
  130. foo ⍲ bar , foo NAND bar : bitwise foo NAND bar, returns result
  131. foo ⍱ bar , foo NOR bar : bitwise foo NOR bar, returns result
  132. foo ⊕ bar , foo XOR bar : bitwise foo XOR bar, returns result
  133. foo ↔ bar , foo XNOR bar : bitwise foo XNOR bar, returns result
  134. foo >> bar , foo » bar : barrel shift foo to the right by bar (left on big endian systems), returns result
  135. foo << bar , foo « bar : barrel shift foo to the left by bar (right on big endian systems), returns result
  136. foo -> bar , foo → bar : shift foo to the right by bar, drop excess (left on big endian systems), returns result
  137. foo <- bar , foo ← bar : shift foo to the left by bar, drop excess (right on big endian systems), returns result
  138.  
  139. ¬foo , ~foo : logical NOT foo
  140. =foo : logical value of foo
  141. foo && bar : logical foo AND bar
  142. foo || bar : logical foo OR bar
  143. foo ~&& bar , foo ¬&& bar , foo !&& bar : logical foo NAND bar
  144. foo ~|| bar , foo ¬|| bar , foo !&& bar : logical foo NOR bar
  145. foo ~= bar , foo ¬= bar , foo != bar : logical foo XOR bar
  146. foo ⇔ bar , foo <> bar , foo IFF bar : logical foo XNOR bar
  147.  
  148. foo ∈ bar , foo ELEMENT bar : test if array or linked list bar contains element foo, returns bool result
  149. foo ∪ bar , foo UNION bar : 1-dimensional union of arrays or linked list foo and bar, returns array
  150. foo ∩ bar , foo INTRSECT bar : 1-dimensional intersection of arrays or linked lists foo and bar, returns array
  151. foo ⊂ bar , foo SUBSET bar : test if array or linked list foo is a subset of bar, returns bool result
  152. foo ⊖ bar , foo DIFF bar : 1 dimensional symetric difference of arrays or linked lists foo and bar, returns array
  153.  
  154. foo < bar , foo LT bar : test if foo is less than bar, returns bool result
  155. foo > bar , foo GT bar : test if foo is greater than bar, returns bool result
  156. foo ≤ bar , foo LE bar : test if foo is less than or equal to bar, returns bool result
  157. foo ≥ bar , foo GE bar : test if foo is greater than or equal to bar, returns bool result
  158. foo ≠ bar , foo NE bar : test if foo is not equal to bar, returns bool result
  159. foo = bar , foo EQ bar : test if foo is equal to bar, returns bool result
  160. foo ≈ bar , foo APROX bar : test if floor or ceiling of foo is equal to the floor or ceiling of bar
  161. foo ≡ bar , foo == bar : test bitwise foo matches bar, returns bool
  162.  
  163. foo ¢ bar , foo CON bar : concatinate the anythings foo and bar, returns the resulting anything. may be an invalid type.
  164.  
  165. strtok(foo, bar) : replace the character bar in string foo with a null character, return pointer to current position.
  166. regex(foo) : compile the regex foo and return the pattern
  167. match(foo, bar) : match all foo in string or array of strings bar, return output as a string or an array of strings
  168. substitute(foo, bar, quux) : substitute all foo for bar in quux, but return output
  169. NOTE: regular expression functions subject to change to make them more like Perl, Awk, and sed than C and C++
  170.  
  171. rand(foo) : number between 0 and foo, returns number
  172. roll(foo, bar) : roll <foo>d<bar>, returns sum of sides
  173. deal(foo, bar) : deal bar sequential elements from array or linked list foo, returns array
  174. choose(foo) : choose 1 random element from array foo and return it
  175. shuffle(foo) : randomize array foo, return array.
  176. sort(foo) : sort array foo, return array.
  177.  
  178. RETURN foo : make the containing function return foo. If you need return to evaluate something, put it in () like FOR, such as RETURN (foo + bar)
  179. RETURN void : does nothing, optimized out
  180.  
  181. lambda(...) {...} : an anonymous function.
  182.  
  183. type(foo) : returns the type of foo
  184. sizeof(foo) : returns the number of bits in anything foo
  185. isnumber(foo) : checks if foo is a number, returns bool
  186. float(foo) : convert int foo to a float
  187. dfloat(foo) : convert int or float foo to a double
  188. NOTE if you want a floating point number to be converted to an int type, you want the function floor(). remember this by the silly image of the float literaly floating, and you need it to be pulled down to the floor.
  189.  
  190. tonumber(foo) : converts string foo to number by mathtypes
  191. atof(foo) : convert string foo to a double
  192. atoi(foo) : convert string foo to a word
  193. atol(foo) : convert string foo to a long
  194.  
  195. tostring(printf_format, foo) : converts foo to a string
  196. toupper(foo) : convert the string foo to UPPERCASE
  197. tolower(foo) : convert the string foo to lowercase
  198. confuseables(foo) : remove all confuseables from string foo, according to the official confuseables.txt
  199.  
  200. add(foo, bar, quux) : add foo to linked list bar at position quux
  201. remove(foo, bar) : remove node bar from linked list foo
  202.  
  203. moveb(foo, bar) : move 1 byte from address bar to address foo and return the value moved. foo and bar can be an interger or an & adress
  204. movew(foo, bar) : move 2 bytes from address bar to address foo and return the value moved. foo and bar can be an interger or an & adress
  205. movel(foo, bar) : move 4 bytes from address bar to address foo and return the value moved. foo and bar can be an interger or an & adress
  206. zerofill(foo) : double the width of int foo by buffering it with zeros. return result. fails if sizeof(foo) is not a power of 2 greater than 8 and less than 33
  207. signfill(foo) : double the width of int foo by buffering it with signed fill. return result. fails if sizeof(foo) is not a power of 2 greater than 8 and less than 33
  208. assembly functions included for writing memory management functions that can be implementation independent.
  209. Final implementation will group non-byte datatypes into byte sized blocks.
  210. (i.e. 8 bools will grouped together to make a byte)
  211. (C can't do this, but this language as written, with disregard to back end, should be able to implement a compiler to do it.)
  212.  
  213. functions for transfinites, base-60 numbers, and graphics deferred.
  214.  
  215. Parseing
  216. --------
  217. comments, ?, and \ have the absolute highest priority.
  218. the double angle bracket quotes are the higest priority symbol besides comments. they, however, can override the default behavior of newlines and ; while those terminate a comment.
  219. quotes, single or double, come next.
  220. functions inside parenthases have the highest precedance of true operators
  221. prefix operators, in the order: number base sign, address signs, and then unary functions or -. a prefix of higher precedence cannot be placed after a prefix of lower precedence.
  222. structure dots are evaluated next
  223. normal functions (functions of the form foo() ) are next.
  224. infix mathmatical operators are next, then tests (set theory, then [in]equality, then bitwise, lastly logical);
  225. postfix operator assignments are evaluated next to last.
  226. assignments are evaluated last.
  227.  
  228. functions such as return, {}, ;, newline, and control functions are evaluated differently. they control how other functions are evaluated.
  229.  
  230. Mathmatical operators follow standard order of operations.
  231. logic and bitwise operators follow the order not, and, or, nand, nor, xor, xnor. not is actually considered a prefix or function.
  232. Operators other than assignments are evaluated left to right; assignment precedent is REVERSED OF THIS.
  233.  
  234. SPECIAL VARIABLES
  235. -----------------
  236.  
  237. OUTPUT : immediately print a string or datatype upon assignment, followed by newline.
  238. INPUT : gets an entire line from input.
  239. NULLDEV : a null device or bitbucket (not the type NULL or NIL). can be used in places where an address or pointer is expected. has the type NULL.
  240. ⅈ : √-1, for complex numbers
  241. ℯ : eulars number, double
  242. π : pi, double
  243. ∞ : uncountable infinity. Implemented as part of floating point support currently, but could be implemented differently on systems without floating point support.
  244. true : bool of 1
  245. false : bool of 0
  246.  
  247. OUTPUT and INPUT are inspired by Snobol4. They have their Pascal meanings in Pascal functions.
  248.  
  249. formating
  250. ---------
  251.  
  252. §comment : if § occurs unescaped on a line, the rest of the line is ignored, or until ;
  253.  
  254. numbers, where foo and bar are strings of digits 1234567890, as well as aAbBcCdDeEfF for hexadecimal
  255. foo : decimal
  256. $foo : hexadecimal
  257. %foo : binary
  258. -foo : negitive signed decimal
  259. @foo : octal
  260. foo.bar : float
  261. -foo.bar : negitive float
  262.  
  263. there is no syntax defined for negitive binary, hexadecimal, or octal numbers
  264.  
  265. Variable names should only consist of letters to prevent unexpected behavior.
  266. using high adress characters may cause an increse in application size
  267.  
  268. The assignment operator is :=, as in algol or pascal
  269.  
  270. "this is a string"
  271.  
  272. 'the raw value of the string'
  273.  
  274. a newline or ; appearing before a string is closed will be interpreted as a literal newline or ; ,
  275. but will cause the parser to generate a warning about the virtues of escape sequences.
  276. a \ followed by whitespace or newline will tell you how to escape an escape character.
  277.  
  278. ?xxxx is the literal unicode character at hex address xxxx. can truncated or extended.
  279.  
  280. FOR (foo) {this is a grouping}
  281. FOR (foo)
  282. {
  283. this is a multiline grouping
  284. }
  285.  
  286. ARRAY foo[4] {this, is, an, array}
  287.  
  288. ARRAY foo[2][3]
  289. {
  290. {this, is, a}
  291. {2, dimensional, array}
  292. }
  293.  
  294. ARRAY foo[2][2][2]
  295. {
  296. {
  297. {this, is}
  298. {an, array}
  299. }
  300. {
  301. {that, contains}
  302. {three, dimensions}
  303. }
  304. }
  305.  
  306. ARRAY foo[2][2] {{newlines, are}{not, required}}
  307.  
  308. ARRAY foo[2][2][2] {neither, are, subgroupings, they, are, just, for, readability}
  309.  
  310. escape character \
  311. special character shortcuts are as in C except as noted above.
  312.  
  313. adressing
  314. ---------
  315.  
  316. &foo : the adress of foo
  317. ¿foo : the AND mask of foo (in future implementations, a bool can be pointer acessed by =(*foo & ¿foo) )
  318. *foo : pointer to foo
  319. £foo : expand an array or linked list as a comma seperated list here (recursively).
  320. using & or * on a decimal, hexidecimal, binary, or octal interger will read the address as an unsigned number
  321.  
  322. DATATYPES
  323. ---------
  324.  
  325. BOOL : 1 bit
  326. BYTE : 8 bits unspecified sign
  327. WORD : 16 bits unspecified sign
  328. LONG : 32 bits unspecified sign
  329. QUAD : 64 bits unspecified sign
  330. S_[BYTE|WORD|LONG|QUAD] : signed versions of above
  331. U_[BYTE|WORD|LONG|QUAD] : unsigned versions of above
  332. STRING : utf8 ansi-style string. multibyte characters are stored internaly as multiple characters.
  333. FLOAT : single precision float
  334. DOUBLE : double precision float
  335. ARRAY : array of anythings, can be multidimensional if rectangular/cuboid/hypercuboid. The zeroth element of an array is hidden, contains the size of the array in the smallest unsigned format, and is not included in the size declaration.
  336. LLIST : a doubly-linked list. implemented as a collection of nodes.
  337. NODE : a structure consisting of a pointer .prev, an anything .data, and a pointer .next
  338. TIMTYP : a structure for holding C style real times.
  339. CLKTYP : an int type for storing the elapsed time. for portability.
  340. DIVTYP : the result of div. a struct with fields numer and denom.
  341. PATTRN : a compiled regex
  342. D_TYPE : a utf-8 string 6 characters wide
  343. VOID : a nothing 0 bits wide
  344. NULL : a null type. Only used for compatibility, pointers default to (U_)BYTE $0.
  345.  
  346. "detonation" in this document refers to a fatal crash
  347. int in this document refers to a byte, word, or long either signed or unsigned
  348. number in this document refers to an int, a float, or a double
  349.  
  350. assigning a negitive or overflowing number to an int will not affect it, since the format is unspecified, so long as the number is within range
  351. assigning a negitive number to an unsigned int will detonate
  352. assigning a number to any int that is outside the range supported by that format will detonate
  353. assigning a value to a pointer should never fail, but may cause strange behavior
  354.  
  355. math typing: int FOO single = single, [int | single] FOO double = double
  356. math typeing in current versions also does C-style interger promotions, and is spotty at best for parenthases functions. THIS IS A BUG (bug#0).
  357. operations dealing with bytes SHOULD not return a word or long unless the value overflows a byte.
  358. operations dealing in signed values SHOULD return a signed value unless the returned value is positive and too large to hold.
  359. all math functions should return the smallest length type possible, and use this type for calculation unless architecture makes this impractical.
  360. Strings and NULL SHOULD evaluate to Quiet_NaN in math fuctions. Strings refuse. this is also bug#0
  361.  
  362. While the language may be initialy written for i686 and x86_64, it was concieved for the 68000.
  363. A backport for 680x0 will be made avalible for the first system whos calling conventions can be located and demystifyed.
  364.  
  365. for now, datatype names are stored in a format that is restricted to 6 characters of the 1 byte subset of UTF-8.
  366. They will eventually be stored in a non-utf encoding to save space, such as PDP-11 RADIX 50
  367.  
  368. C error strings should all be converted to a more consistant string of "NULL".
  369.  
  370. DEFINEING FUNCTIONS
  371. -------------------
  372.  
  373. a function can be defined as follows:
  374.  
  375. FUNCTION foo(bar, quux)
  376. {
  377. if(bar < quux) {return bar}
  378. else {return quux}
  379. }
  380.  
  381. this will make a function that returns the lesser of two numbers, bar and quux.
  382. Note there is no checking to see if bar or quux are numbers.
  383. If bar or quux are not numbers, the function will detonate.
  384. a function can return more than one type, hence it is not necessary to say what it's return type is like in C
  385.  
  386.  
  387. EXAMPLES
  388. --------
  389. mandatory hello world program.
  390. Unlike C, but like older languages and modern interpreted languages,
  391. there is no main function required. one could define a main function
  392. and call it at the end of the program, but this is unneccisary.
  393. It is recommended to have things defined before you use them, however. The compiler doesn't read that far ahead.
  394.  
  395. Example 1:
  396. printf("Hello, World!\n")
  397.  
  398. Example 2:
  399. OUTPUT := "Hello, World!"
  400.  
  401. Note that all examples are only 1 line of code.
  402. note the second example also resembles Snobol4 code; this was the intent.
  403.  
  404. BUILDING
  405. --------
  406. The source for the first alpha version is projected to need:
  407. - a POSIX shell
  408. - a Make utility
  409. - a Pascal compiler compatible with ISO Pascal
  410. - a C compiler, compatible with C89, C99, AND C11
  411. - a Fortran compiler compatible with FORTRAN 77
  412. - a C++ compiler, compatible with C++98 AND C++11
  413. - an Assembler
  414. - a Linker
  415. - a C preprocessor
  416. - Plex and Pyacc
  417. - flex|lex and yacc|bison
  418. - wget or curl (to ensure the most current unicode files)
  419. - an Awk interpreter (for processing the unicode files)
  420.  
  421. To implement both the C and Pascal sides of the file, The current implementation is to "Volley" the file back and fourth between flex/lex and plex until no tokens remain.
  422. This is done by having both lexers switch to outputting a second source file that contains the functions destined for the other, while at the same time only returning an extern function token for their own language.
  423. This can be done recursively.
  424.  
  425. future rewrites may also require
  426. - a lua interpreter/compiler
  427. - a Common Lisp compiler
  428. - a Perl Compiler
  429. - an M4 macro processor
  430. - Nonstandard libraries, such as Allegro, nCurses, or PortAudio
  431.  
  432.  
  433. Yes, this first alpha version is expected to be huge in size and have dozens of intermidiate object files. I expect it to get bigger, not smaller, as there is a 1:1 corraspondance between primary functions and object files.
  434. This is because the alpha version will be only the first and second step in a bootstrapping process, and the first revision of them at that.
  435. I do expect the final version of the bootstrapping process to gradually get smaller after the third iteration as external object files are rolled into a single file and optimized. I'm probably wrong.
  436. The use of the C preprocessor is not expected to change. It does everything I need it to.
  437. I don't forsee needing any other languages for the commands I've included, but I can forsee complications which may arise that could call for the ones in the second list. the two lists taken together covers most of my useful programming skills. amoungst the languages that I will definately NOT be including is Cobol.
  438. This language is designed for POSIX-compliant enviroments. Barring a signifigant change in policy by Microsoft, Windows support is unlikely to be feasible, but may be possible by extra-ordinary mesures (like compleatly reimplimenting everything about how unicode is implemented internaly).
  439.  
  440. Primary functions
  441. -----------------
  442. A primary function is a function that is included in the first step of the bootstrapping process. CPP Macros don't count.
  443. Any built-in function that is not a function that is not a primary function is called a "secondary function", and can be implemented with primary functions.
  444. This language standard does not mandate that the functions are implemented in the languages specified; Ideally, they could all be reduced to a single language.
  445. Here is a list of how I implement built-ins in the first 2 iterations:
  446.  
  447. function: 1st iteration , 2nd iteration
  448.  
  449. wait() : ~ , native implementation
  450. time() : C , native calling object
  451. clock() : C , native calling object
  452. IF (foo) {} : C , native calling object
  453. ELSE {} : C , native calling object
  454. WHILE (foo) {} : C , native calling object
  455. DOTIMES (foo) {} : C , native reimplimentation
  456. BREAK : parser , native parser
  457. GOTO (foo) : parser , native parser
  458. MAP (foo, bar) {} : C , native calling object
  459. ¶foo : parser , native parser
  460. printf(...) : C , native calling object
  461. sprintf(...) : C , native calling object
  462. fprintf(...) : C , native calling object
  463. scanf(...) : C , native calling object
  464. sscanf(...) : C , native calling object
  465. fscanf(...) : C , native calling object
  466. fflush(...) : C , native calling object
  467. fopen(...) : C , native calling object
  468. fclose(...) : C , native calling object
  469. fseek(...) : C , native calling object
  470. ftell(...) : C , native calling object
  471. rewind(...) : C , native calling object
  472. write(...) : Pascal , native calling object
  473. writeln(...) : Pascal , native calling object
  474. read(...) : Pascal , native calling object
  475. readln(...) : Pascal , native calling object
  476. FUNCTION foo() {...} : C , native calling object
  477. VARIADIC foo(bar) {...} : C , native calling object
  478. EXTERN foo() : C , native calling object
  479. TYPE FOO bar : Pascal OR C , native calling object
  480. FOO bar, quux, xyzzy : C OR Pascal , native calling object
  481. UNDECLARE bar, quux, xyzzy : C , native calling object
  482. foo[bar][quux] : C , native calling object
  483. STRUCT FOO {...} : C , native calling object
  484. foo.bar : C , native calling object
  485. LLIST foo {...} : Pascal , native calling object
  486. EXIT : C , native calling object
  487. foo + bar : C , native calling object OR Fortran
  488. foo - bar : C , native calling object OR Fortran
  489. -foo : C , native calling object OR Fortran
  490. foo * bar , foo × bar : C , native calling object OR Fortran
  491. foo / bar , foo ÷ bar : C , native calling object OR Fortran
  492. foo ^ bar , foo ** bar , foo ⋆ bar : C , native calling object OR Fortran
  493. foo ^^ bar : C , native calling object OR Fortran
  494. foo % bar : C , native calling object OR Fortran
  495. foo LOG bar , foo ⍟ bar : C , native calling object OR Fortran
  496. foo ROOT bar , foo √ bar : C , native calling object OR Fortran
  497. !foo : C , native calling object OR Fortran
  498. ¡foo : C , native calling object OR Fortran
  499. foo nCr bar : C , native calling object OR Fortran
  500. foo nPr bar : C , native calling object OR Fortran
  501. elog(foo) : C , native calling object OR Fortran
  502. abs(foo) : C , native calling object OR Fortran
  503. cabs(foo) : C , native calling object OR Fortran
  504. floor(foo) : C , native calling object OR Fortran
  505. ceiling(foo) : C , native calling object OR Fortran
  506. div(foo, bar) : C , native calling object OR Fortran
  507. sqrt(foo) : Pascal , native calling object OR Fortran
  508. cbrt(foo) : Pascal , native calling object OR Fortran
  509. max(foo, bar...) : C , native calling object OR Fortran
  510. min(foo, bar...) : C , native calling object OR Fortran
  511. mean(foo, bar...) : C , native calling object OR Fortran
  512. median(foo, bar...) : Pascal , native reimplimentation
  513. mode(foo, bar) : Pascal , native reimplimentation
  514. sin(foo) : C , native calling object OR Fortran
  515. cos(foo) : C , native calling object OR Fortran
  516. tan(foo) : C , native calling object OR Fortran
  517. cot(foo) : C , native calling object OR Fortran
  518. sec(foo) : C , native calling object OR Fortran
  519. csc(foo) : C , native calling object OR Fortran
  520. arcsin(foo) : C , native calling object OR Fortran
  521. arccos(foo) : C , native calling object OR Fortran
  522. arctan(foo) : C , native calling object OR Fortran
  523. arccot(foo) : C , native calling object OR Fortran
  524. arcsec(foo) : C , native calling object OR Fortran
  525. arccsc(foo) : C , native calling object OR Fortran
  526. foo++ : C calling Asm , native calling object
  527. foo-- : C calling Asm , native calling object
  528. foo>> : C calling Asm , native calling object
  529. foo<< : C calling Asm , native calling object
  530. foo-> : C calling Asm , native calling object
  531. foo<- : C calling Asm , native calling object
  532. `foo : C calling Asm , native calling object
  533. foo ∧ bar , foo AND bar , foo & bar : C , Native calling object or Asm
  534. foo ∨ bar , foo OR bar , foo | bar : C , Native calling object or Asm
  535. foo ⍲ bar , foo NAND bar : C , Native calling object or Asm
  536. foo ⍱ bar , foo NOR bar : C , Native calling object or Asm
  537. foo ⊕ bar , foo XOR bar : C , Native calling object or Asm
  538. foo ↔ bar , foo XNOR bar : C , Native calling object or Asm
  539. foo >> bar , foo » bar : C , Native calling object or Asm
  540. foo << bar , foo « bar : C , Native calling object or Asm
  541. foo -> bar , foo → bar : C , Native calling object or Asm
  542. foo <- bar , foo ← bar : C , Native calling object or Asm
  543. ¬foo , ~foo : Pascal , Native calling object
  544. =foo : Pascal , Native calling object
  545. foo && bar : Pascal , Native calling object
  546. foo || bar : Pascal , Native calling object
  547. foo ~&& bar , foo ¬&& bar , foo !&& bar : Pascal , Native calling object
  548. foo ~|| bar , foo ¬|| bar , foo !&& bar : Pascal , Native calling object
  549. foo ~= bar , foo ¬= bar , foo != bar : Pascal , Native calling object
  550. foo ⇔ bar , foo <> bar , foo IFF bar : Pascal , Native calling object
  551. foo ∈ bar , foo ELEMENT bar : Pascal OR C , Native calling object
  552. foo ∪ bar , foo UNION bar : Pascal OR C , Native calling object
  553. foo ∩ bar , foo INTRSECT bar : Pascal OR C , Native calling object
  554. foo ⊂ bar , foo SUBSET bar : Pascal OR C , Native calling object
  555. foo ⊖ bar , foo DIFF bar : Pascal OR C , Native calling object
  556. foo < bar , foo LT bar : C , Native calling object
  557. foo > bar , foo GT bar : C , Native calling object
  558. foo ≤ bar , foo LE bar : C , Native calling object
  559. foo ≥ bar , foo GE bar : C , Native calling object
  560. foo ≠ bar , foo NE bar : C , Native calling object
  561. foo = bar , foo EQ bar : C , Native calling object
  562. foo ≈ bar , foo APROX bar : C , Native calling object
  563. foo ≡ bar , foo == bar : C , Native calling object
  564. foo ¢ bar , foo CON bar : C++ , Native calling object
  565. strtok(foo, bar) : C , native calling object
  566. regex(foo) : C++ , Native calling object
  567. match(foo, bar) : C++ , Native calling object
  568. substitute(foo, bar, quux) : C++ , Native calling object
  569. rand(foo) : C , Native calling object
  570. deal(foo, bar) : Pascal , native reimplementation
  571. shuffle(foo) : Pascal , native calling object
  572. sort(foo) : Pascal , native calling object
  573. RETURN foo : Kind of happens??? , native NOTE: fudging the returns is what un-types the language.
  574. lambda (...) {...} : C , native calling object
  575. type(foo) : C++ , native calling object
  576. sizeof(foo) : C , native calling object
  577. float(foo) : C , native calling object
  578. dfloat(foo) : C , native calling object
  579. minisize(foo) : Pascal calling C++ , native calling object
  580. atof(foo) : C , native calling object
  581. atoi(foo) : C , native calling object
  582. atol(foo) : C , native calling object
  583. tostring(printf_format, foo) : C , native calling object
  584. add(foo, bar, quux) : Pascal , native calling object
  585. remove(foo, bar) : Pascal , native calling object
  586. moveb(foo, bar) : Asm , native calling object
  587. movew(foo, bar) : Asm , native calling object
  588. movel(foo, bar) : Asm , native calling object
  589. zerofill(foo) : C calling Asm , native calling object
  590. signfill(foo) : C calling Asm , native calling object
  591.  
  592. OUTPUT is implemented as a Pascal object using assignment to a file object and put.
  593. INPUT is implemented in a C object using fgets and sscanf.
  594. £foo is a very complicated parser macro that uses function prototype lookup to look up <arguments> number of array pointers.
  595. datatypes are otherwise implemented in Pascal.
  596. the adressing symbols are implemented as C objects.
  597. a garbage collector is a HIGH PRIORETY to-do, see bug#1.
  598.  
  599. A modern byte-addressable B would make everything A LOT EASIER.
  600.  
  601. PARSING (CONTINUED)
  602. -------------------
  603.  
  604. a variable name may not contain any technical symbol. these include:
  605. ' " ; [ ] { } | \ < > , . ? / ~ ` ! @ # $ % ^ & * ( ) - + = ¶ × ÷ ⋆ ⍟ √ ¡ ∧ ∨ ⍲ ⍱ ⊕ ↔ ≡
  606. » « → ← ¬ ⇔ ∈ ∪ ∩ ⊂ ⊖ ≤ ≥ ≠ ≈ ¢ ␣
  607.  
  608. a variable name may not contain a number as the first character
  609. 0 1 2 3 4 5 6 7 8 9
  610.  
  611. a variable name may not overlap exactly with a special variable.
  612. OUTPUT INPUT NULL ⅈ ℯ π ∞ true false
  613.  
  614. a variable name may not overlap with a function name.
  615. [set of all built-in functions]
  616.  
  617. a function or variable in the first level of the bootstrapper may not have the form
  618. volly_[c|pascal]_########()
  619. The first level of the bootstrapper PRODUCES NO WARNINGS.
  620.  
  621. a variable name may not contain an unprintable character [some stand-ins iterated]
  622. ␀ ␁ ␂ ␃ ␄ ␅ ␆ ␇ ␈ ␉ ␊ ␋ ␌ ␍ ␎ ␏ ␐ ␑ ␒ ␓ ␔ ␕ ␖ ␗ ␘ ␙ ␚ ␛ ␜ ␝ ␞ ␟ ␠ ␡
  623.  
  624. forbidden symbols will NEVER include:
  625. _ : ¦ · • ♠ ♡ ♢ ♣ ♤ ♥ ♦ ♧ ♔ ♕ ♖ ♗ ♘ ♙ ♚ ♛ ♜ ♝ ♞ ♟ [set of all unicode letters]
  626.  
  627. Tokens are seperated by Whitespace. Whitespace can be specified manually at metacompilation time. By default, this includes:
  628. ␠ ␉ ␣
  629.  
  630. VERSION NUMBERS
  631. ---------------
  632. major version : a number that represents the full version number
  633. minor version : the number of minor revisions since the last time the version number was changed
  634. revision : tiny revisions since last minor version
  635. documentation version : the version of the documentation for the minor version. appears as a letter (starting at a) following the full version number when the previous documentation for the same version was errornous, ommited otherwise.
  636. testbuild number : the sequential testbuild number
  637. testbuild date : the date of the testbuild
  638.  
  639. format: Ver.major.minor[doc] #NUMBER DD-MM-YYYY
  640.  
  641. BUG REPORTS
  642. -----------
  643. Number Reporter version Status Priority
  644. Description
  645. {
  646. Actions taken/planned Result? "IF NOT THEN"
  647. . [waiting] "IF NOT THEN"
  648. . [waiting] "IF NOT THEN"
  649. . [waiting] "IF NOT THEN"
  650. LAST RESORT mediocore solution [waiting]
  651. -or-
  652. HOTFIX mediocore solution [waiting] "UNTIL"
  653. LONGFIX extraodinary measures [waiting]
  654. }&{
  655. Actions for next part of issue.....
  656.  
  657. bug#0 Author 0.1.10 0000000 00-00-0000 Deferred to alpha Medium
  658. Mathtypes, Math error returns tied to C/Pascal standards.
  659. {
  660. Write assembly routines for each primitive function on each different size input... lolnope
  661. Forth subroutines for math functions... the fourth compiler I (and most prospect endusers) have cannot link to C IF NOT THEN
  662. It would seem a standards compliant FORTRAN 77 compiler MUST have 8-bit capabilities.... Should work perfectly if fortran compiler is compliant. cast unsigned types up by 1 size, call C for floats, and always call minisize() when done.
  663. }&{
  664. String handling is a pascal-types issue. Can easily be handled with some typechecks in the second stage of bootstrap... Partialy Depricated
  665. 0.1.16 outlines the plans for the "Volley" type lexer, thus migrating a large portion, if not all, of the relavent code for the above string issue back to C. Will have to wait and see how this changes things [waiting]
  666. }
  667.  
  668. bug#1 Author 0.1.14 0000000 00-00-0000 Unconfirmed CRITICAL
  669. Possible memory leak, Input buffers defined in C-side backing but not derefed after string is sent to Pascal-side.
  670. {
  671. It's too big and too spidery to know for sure... [waiting] IF NOT THEN
  672. rewrite C-side buffer allocating... [waiting]
  673. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement