283: # 516 "./lpsrc/flx_types.ipk"
284: and parameter_t = id_t * typecode_t
285: and macro_parameter_type_t =
286: | Ident
287: | Expr
288: | Stmt
289: and macro_parameter_t = id_t * macro_parameter_type_t
290: and lvalue_t = [
291: | `Val of range_srcref * string
292: | `Var of range_srcref * string
293: | `Name of range_srcref * string
294: | `Skip of range_srcref
295: | `List of tlvalue_t list
296: | `Expr of range_srcref * expr_t
297: ]
298: and tlvalue_t = lvalue_t * typecode_t option
299:
300: and funkind_t = [
301: | `Object
302: | `Function
303: | `InlineFunction
304: | `NoInlineFunction
305: | `Ctor
306: ]
307:
308: and property_t = [
309: | `Recursive
310: | `Inline
311: | `NoInline
312: | `Inlining_started
313: | `Inlining_complete
314: | `Generated of string
315: | `Heap_closure (* a heaped closure is formed *)
316: | `Explicit_closure (* explicit closure expression *)
317: | `Stackable (* closure can be created on stack *)
318: | `Stack_closure (* a stacked closure is formed *)
319: | `Unstackable (* closure cannot be created on stack *)
320: | `Pure (* closure not required by self *)
321: | `Uses_global_var (* a global variable is explicitly used *)
322: | `Ctor (* Class constructor procedure *)
323:
324: (* one of the below must be set before code generation *)
325: | `Requires_ptf (* a pointer to thread frame is needed *)
326: | `Not_requires_ptf (* no pointer to thread frame is needed *)
327:
328: | `Uses_gc (* requires gc locally *)
329: ]
330:
331: and type_qual_t = [
332: | base_type_qual_t
333: | `Raw_needs_shape of typecode_t
334: ]
335:
336: and requirement_t = [
337: | `Body_req of c_t
338: | `Header_req of c_t
339: | `Named_req of qualified_name_t
340: | `Property_req of string
341: | `Package_req of c_t
342: ]
343:
344: and ikind_t = [
345: | `Header
346: | `Body
347: | `Package
348: ]
349:
350: and raw_req_expr_t =
351: [
352: | `RREQ_atom of requirement_t
353: | `RREQ_or of raw_req_expr_t * raw_req_expr_t
354: | `RREQ_and of raw_req_expr_t * raw_req_expr_t
355: | `RREQ_true
356: | `RREQ_false
357: ]
358:
359: and named_req_expr_t =
360: [
361: | `NREQ_atom of qualified_name_t
362: | `NREQ_or of named_req_expr_t * named_req_expr_t
363: | `NREQ_and of named_req_expr_t * named_req_expr_t
364: | `NREQ_true
365: | `NREQ_false
366: ]
367:
368: and prec_t = string
369: and glr_term_t =
370: [
371: | `GLR_name of qualified_name_t
372: | `GLR_opt of glr_term_t
373: | `GLR_ast of glr_term_t
374: | `GLR_plus of glr_term_t
375: | `GLR_alt of glr_term_t list
376: | `GLR_seq of glr_term_t list
377: ]
378:
379: and glr_entry_t = string option * glr_term_t
380: and production_t = glr_entry_t list
381:
382: and reduced_glr_entry_t = string option * qualified_name_t
383: and reduced_production_t = reduced_glr_entry_t list
384: and params_t = parameter_t list * expr_t option (* second arg is a constraint *)
385: and class_member_t = [
386: | `MemberVal of id_t * typecode_t * c_t option
387: | `MemberVar of id_t * typecode_t * c_t option
388: | `MemberFun of id_t * int option * vs_list_t * typecode_t * c_t option
389: | `MemberProc of id_t * int option * vs_list_t * typecode_t * c_t option
390: | `MemberCtor of id_t * int option * typecode_t * c_t option
391: ]
392:
393: and typeclass_member_t = [
394: | `TypeClassMemberFun of id_t * typecode_t
395: | `TypeClassMemberProc of id_t * typecode_t
396: ]
397:
398: and ast_term_t =
399: [
400: | `Expression_term of expr_t
401: | `Statement_term of statement_t
402: | `Statements_term of statement_t list
403: | `Identifier_term of string
404: | `Keyword_term of string
405: | `Apply_term of ast_term_t * ast_term_t list
406: ]
407:
408: and statement_t =
409: [
410: | `AST_include of range_srcref * string
411: | `AST_open of range_srcref * qualified_name_t
412: | `AST_inject_module of range_srcref * qualified_name_t
413: | `AST_use of range_srcref * id_t * qualified_name_t
414: | `AST_comment of string (* for documenting generated code *)
415: (*
416: | `AST_public of range_srcref * string * statement_t
417: *)
418: | `AST_private of range_srcref * statement_t
419:
420: (* definitions *)
421: | `AST_reduce of range_srcref * id_t * vs_list_t * parameter_t list * expr_t * expr_t
422: | `AST_axiom of range_srcref * id_t * vs_list_t * parameter_t list * expr_t
423: | `AST_function of range_srcref * id_t * vs_list_t * params_t * (typecode_t * expr_t option) * property_t list * statement_t list
424: | `AST_curry of range_srcref * id_t * vs_list_t * params_t list * (typecode_t * expr_t option) * funkind_t * statement_t list
425: | `AST_object of range_srcref * id_t * vs_list_t * params_t * statement_t list
426: | `AST_regdef of range_srcref * string * regexp_t
427: | `AST_glr of range_srcref * string * typecode_t * (range_srcref * production_t * expr_t) list
428:
429: (* macros *)
430: | `AST_macro_name of range_srcref * id_t * id_t
431: | `AST_macro_names of range_srcref * id_t * id_t list
432: | `AST_expr_macro of range_srcref * id_t * macro_parameter_t list * expr_t
433: | `AST_stmt_macro of range_srcref * id_t * macro_parameter_t list * statement_t list
434: | `AST_macro_block of range_srcref * statement_t list
435: | `AST_macro_val of range_srcref * id_t list * expr_t
436: | `AST_macro_vals of range_srcref * id_t * expr_t list
437: | `AST_macro_var of range_srcref * id_t list * expr_t
438: | `AST_macro_assign of range_srcref * id_t list * expr_t
439: | `AST_macro_forget of range_srcref * id_t list
440: | `AST_macro_label of range_srcref * id_t
441: | `AST_macro_goto of range_srcref * id_t
442: | `AST_macro_ifgoto of range_srcref * expr_t * id_t
443: | `AST_macro_proc_return of range_srcref
444:
445: (* type macros *)
446: | `AST_macro_ifor of range_srcref * id_t * id_t list * statement_t list
447: | `AST_macro_vfor of range_srcref * id_t list * expr_t * statement_t list
448:
449: (* composition of statements: note NOT A BLOCK *)
450: | `AST_seq of range_srcref * statement_t list
451:
452: (* types *)
453: | `AST_union of range_srcref * id_t * vs_list_t * (id_t * int option * typecode_t) list
454: | `AST_struct of range_srcref * id_t * vs_list_t * (id_t * typecode_t) list
455: | `AST_cstruct of range_srcref * id_t * vs_list_t * (id_t * typecode_t) list
456: | `AST_cclass of range_srcref * id_t * vs_list_t * class_member_t list
457: | `AST_class of range_srcref * id_t * vs_list_t * statement_t list
458: | `AST_type_alias of range_srcref * id_t * vs_list_t * typecode_t
459: | `AST_inherit of range_srcref * id_t * vs_list_t * qualified_name_t
460: | `AST_inherit_fun of range_srcref * id_t * vs_list_t * qualified_name_t
461:
462: (* variables *)
463: | `AST_val_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
464: | `AST_lazy_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
465: | `AST_var_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
466:
467: (* module system *)
468: | `AST_untyped_module of range_srcref * id_t * vs_list_t * statement_t list
469:
470: (* control structures: primitives *)
471: | `AST_label of range_srcref * id_t
472: (*
473: | `AST_whilst of range_srcref * expr_t * statement_t list
474: | `AST_until of range_srcref * expr_t * statement_t list
475: *)
476: | `AST_goto of range_srcref * id_t
477: | `AST_ifgoto of range_srcref * expr_t *id_t
478: | `AST_ifreturn of range_srcref * expr_t
479: | `AST_ifdo of range_srcref * expr_t * statement_t list * statement_t list
480: | `AST_ifnotgoto of range_srcref * expr_t * id_t
481: | `AST_call of range_srcref * expr_t * expr_t
482: | `AST_assign of range_srcref * string * tlvalue_t * expr_t
483: | `AST_cassign of range_srcref * expr_t * expr_t
484: | `AST_jump of range_srcref * expr_t * expr_t
485: | `AST_loop of range_srcref * id_t * expr_t
486: | `AST_svc of range_srcref * id_t
487: | `AST_fun_return of range_srcref * expr_t
488: | `AST_proc_return of range_srcref
489: | `AST_nop of range_srcref * string
490: | `AST_assert of range_srcref * expr_t
491: | `AST_apply_ctor of range_srcref * id_t * expr_t * expr_t
492: | `AST_init of range_srcref * id_t * expr_t
493:
494: (* binding structures [prolog] *)
495: | `AST_abs_decl of range_srcref * id_t * vs_list_t * type_qual_t list * c_t * raw_req_expr_t
496: | `AST_ctypes of range_srcref * (srcref * id_t) list * type_qual_t list * raw_req_expr_t
497: | `AST_const_decl of range_srcref * id_t * vs_list_t * typecode_t * c_t * raw_req_expr_t
498: | `AST_fun_decl of range_srcref * id_t * vs_list_t * typecode_t list * typecode_t * c_t * raw_req_expr_t * prec_t
499: | `AST_callback_decl of range_srcref * id_t * typecode_t list * typecode_t * raw_req_expr_t
500: (* embedding *)
501: | `AST_insert of range_srcref * id_t * vs_list_t * c_t * ikind_t * raw_req_expr_t
502: | `AST_code of range_srcref * c_t
503: | `AST_noreturn_code of range_srcref * c_t
504:
505: | `AST_export_fun of range_srcref * suffixed_name_t * string
506: | `AST_export_type of range_srcref * typecode_t * string
507:
508: | `AST_user_statement of range_srcref * string * ast_term_t
509: ]
510:
511:
512: and exe_t =
513: [
514: | `EXE_code of c_t (* for inline C++ code *)
515: | `EXE_noreturn_code of c_t (* for inline C++ code *)
516: | `EXE_comment of string (* for documenting generated code *)
517: | `EXE_label of string (* for internal use only *)
518: | `EXE_goto of string (* for internal use only *)
519: | `EXE_ifgoto of expr_t * string (* for internal use only *)
520: | `EXE_ifnotgoto of expr_t * string (* for internal use only *)
521: | `EXE_call of expr_t * expr_t
522: | `EXE_jump of expr_t * expr_t
523: | `EXE_loop of id_t * expr_t
524: | `EXE_svc of id_t
525: | `EXE_fun_return of expr_t
526: | `EXE_proc_return
527: | `EXE_nop of string
528: | `EXE_init of id_t * expr_t
529: | `EXE_iinit of (id_t * int) * expr_t
530: | `EXE_assign of expr_t * expr_t
531: | `EXE_assert of expr_t
532: | `EXE_apply_ctor of id_t * expr_t * expr_t
533: ]
534:
535: type sexe_t = range_srcref * exe_t
536:
The whole of a compilation unit, this is the data structure
returned by parsing a whole file.